@verb #2348:"monster_fight" this none this rxdo #9452 @program #2348:"monster_fight" this none this if (!(caller_perms() in this.admins)) raise(E_PERM) else dude = args[1] monster = args[2] if (typeof(dude) != WAIF || typeof(monster) != LIST || length(monster) != 7) raise(E_INVARG) else dude->in_fight = 1 dude->forest_fights = dude->forest_fights - 1 player:tell(this:format(this:data_fetch("fighting", "start_fight"), dude, 0, monster[1])) first_time = 1 while (1) monster_attack = 0 if (first_time && random(50) == 1) player:tell(" " + monster[1] + " surprises you.") monster_attack = 1 else player:tell(this:format(this:data_fetch("fighting", "fight_menu"), dude, 0, monster[1], monster[6])) player:tell(" Your command, " + player:title() + "? [A] : ") answer = $command_utils:read() if (answer == "" || answer == "a") monster_attack = 1 damage = dude->strength / 2 + random(dude->strength / 2) if (damage > 0) player:tell(" You hit " + monster[1] + " for " + tostr(damage) + "!") monster[6] = monster[6] - damage else player:tell("miss, you shouldn't ever see this") endif if (monster[6] <= 0) player:tell(this:format(this:data_fetch("fighting", "fight_win"), dude, 0, monster[1], monster[3], monster[5])) dude->gold_hand = dude->gold_hand + monster[3] dude->experience = this:intadd(dude->experience, monster[5]) break endif elseif (answer == "s") $lord_database:tell_stats(dude) elseif (answer == "r") "Not sure how the mechanics of this work in the real game." if (random(6) == 1) player:tell(" You attempt to run, but " + monster[1] + " sees you!") monster_attack = 1 else if (random(2) == 1) damage = random(dude->max_hp / 2) dude->current_hp - damage >= 1 || (damage = dude->current_hp - 1) dude->current_hp = dude->current_hp - damage player:tell(" You manage to escape, but lose " + tostr(damage) + " hit points in the process.") break else player:tell(" You escape successfully.") break endif endif endif endif first_time = 0 if (monster_attack) damage = monster[2] / 2 + random(monster[2] / 2) - dude->defense if (damage > 0) player:tell(" ** " + monster[1] + " hits with its " + monster[4] + " for " + tostr(damage) + " damage! **") dude->current_hp = dude->current_hp - damage else player:tell(" ** " + monster[1] + " misses you completely! **") endif if (dude->current_hp <= 0) player:tell(this:format(this:data_fetch("fighting", "fight_lose"), dude, 0, monster[1], monster[3], monster[5])) dude->gold_hand = 0 dude->experience = toint(tofloat(dude->experience) * 0.9) dude->dead = 1 break endif endif endwhile dude->in_fight = 0 return dude->current_hp > 0 ? 1 | 2 endif endif "Last modified by Crono (#9452) on Sun Sep 8 23:22:56 2002 MDT." .