/*********************
SSJ4_Gohan_Majin's
Battle System
*********************/
/********
Bug Reports = Dan321ny@AOL.com
********/
mob
var
hp = 100
maxhp = 100
exp = 0
maxexp = 100
level = 1
strength = 5
defense = 5
Stat()
..()
statpanel("[src]'s Stats")
stat("Health","[src.hp]/[src.maxhp]")
stat("Level",src.level)
stat("Experience","[src.exp]/[src.maxexp]")
stat("Strength",src.strength)
stat("Defense",src.defense)
proc/death_check(mob/M as mob)//handles death
if(src.hp <= 0)
M <<"You killed [src]!"
if(src.client)
src <<"[M] killed you!"
src.loc = locate(1,1,1)
src.hp = src.maxhp
else
src <<"You have been killed by [M]!"
del(src)
proc/stat_up()
src.strength += rand(2,10)
src.defense += rand(3,10)
src.maxhp += rand(1,5)
src.hp = src.maxhp
src <<"\blue You begin to feel stronger as your stats increase!"
proc/level_up()
if(src.client)
if(src.exp >= src.maxexp)//if the players exp matches or is higher then the players maxexp
src.stat_up()
src.level += 1//adds a level
src <<"\red You gained a Level!"//informs player that they gained a level
src.maxexp *= 2//doubles the max exp by 2
src.exp = 0//exp back to zero
else
return..()
verb/Attack(mob/M in oview(1))
set category = "Battle"
var/damage = src.strength - M.defense
if(M.client)
M.hp -= damage
src <<"You attack [M] for [damage]!"
M <<"You are being attacked by [src]!"
src.level_up()
M.death_check(src)
else
M.hp -= damage
src <<"You attack [M] for [damage]!"
M <<"You are being attacked by [src]!"
var/random = rand(1,3)
if(random == 1)
src.exp += 4
if(random == 2)
src.exp += 3
if(random == 3)
src.exp ++
src.level_up()
M.death_check(src)
mob
villan
Monster
icon = 'monster.dmi'
name = "Monster"
hp = 200
strength = 15
defense = 9
var/mob/character/Player
New()
. = ..()
spawn()
move()
proc/move()
while(src)
var/player_found = 0
for(Player in oview(8,src))
step_towards(src,Player)
player_found = 1
break
if(player_found != 1)
step_rand(src)
sleep(10)
sleep(5)
Bump(mob/M)
if(istype(M,/mob/character))
attack(M)
proc/attack(mob/M)
var/damage = rand(1,strength)
M.hp -= damage
M <<"You are being attacked by [src]!"
src.exp += rand(5,10)
src.level_up()
M.death_check(src)
mob
character
hp = 100
maxhp = 100
exp = 0
maxexp = 100
level = 1
strength = 15
defense = 6
/***********
Example character creation
--------------------------
The code below gives an example of setting up a character.
This is just to give you ideas for how you can do it yourself.
************/
mob/creating_character
base_save_allowed = 0 // If player quits before choosing, don't want to save this mob.
Login()
// Spawn here to avoid problems with calling prompts during login.
spawn()
src.CreateCharacter()
proc/CreateCharacter()
// In this case, the code creates a /mob/human or /mob/ogre with the specified attributes.
// Get the character information from them. (You would probably want to do with this a browser page.)
var/prompt_title = "New Character"
var/help_text = "What do you want to name the character?"
var/default_value = key
var/char_name = input(src, help_text, prompt_title, default_value) as null|text
if (!char_name)
// Guess they don't want to create a new character after all, so send them to choose a character.
client.base_ChooseCharacter()
return
// Make sure there isn't already a character named that.
// Character names are stored as ckey, so get the ckey version of the name.
var/ckey_name = ckey(char_name)
var/list/characters = client.base_CharacterNames()
if (characters.Find(ckey_name))
alert("You already have a character named that! Please choose another name.")
src.CreateCharacter()
return
var/list/classes = list("Twin Blade(Male)", "Heavy Blade(Female)")
help_text = "Which class would you like to be?"
default_value = "Twin Blade(Male)"
var/char_class = input(src, help_text, prompt_title, default_value) in classes
// Okay we have enough information, so it's time to create the character and switch the player to it.
var/mob/new_mob
switch(char_class)
if ("Twin Blade(Male)") new_mob = new /mob/cop()
if ("Heavy Blade(Female)") new_mob = new /mob/nurse()
// Set the attributes.
new_mob.name = char_name
// Now switch the player client over to the new mob and delete myself since I'm no longer needed.
src.client.mob = new_mob
var/turf/first_location = locate(1, 1, 1)
new_mob.Move(first_location)
del(src)
mob
Login()
..()
// This is just here for this sample, to make it clear which mob you've logged into.
sample_report()
verb
add_save_verb()
// Adds save_me verb to the mob, to show that verb saving works.
src.verbs += /mob/proc/save_me
remove_save_verb()
src.verbs -= /mob/proc/save_me
proc
sample_report()
src << "You log into 'The World'"
save_me()
// This demonstrates verb saving and how to manually save the mob whenever you want..
// This proc gets added and saved as a verb only if add_verb is called by the player.
src.client.base_SaveMob()
src << "\red You have been saved."
mob/cop
icon = 'Shugo.dmi'
mob/nurse
icon = 'Rena.dmi'
Problem description:When I log into test world, I have no Errors it just that the mobs won't attack me when I make my character but I can attack the mobs this is the only problem tell me why? pleeeeeeeeease