Combat Manger Object #42
2 verbs · 20 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
init_order | this none this | rwxd | #42 | 23 |
battle | this none this | rwxd | #42 | 72 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
base_thac0 | #42 | rw | #10 | 20 |
round_length | #42 | rw | #10 | 2 |
hit_color | #42 | rw | #10 | "%Y" |
crit_color | #42 | rw | #10 | "%R" |
miss_color | #42 | rw | #10 | "%c" |
end_per_round | #42 | rw | #10 | 4 |
description | #1 | rw | #10 | <clear> |
aliases | #1 | rw | #10 | <clear> |
home | #1 | rw | #10 | <clear> |
short_desc | #1 | rw | #10 | <clear> |
core | #1 | rw | #10 | 1 |
handedness | #1 | rw | #10 | <clear> |
base_enc | #1 | rw | #10 | <clear> |
base_weight | #1 | rw | #10 | <clear> |
capacity | #1 | rw | #10 | <clear> |
max_fit | #1 | rw | #10 | <clear> |
pprep | #1 | rw | #10 | <clear> |
gprep | #1 | rw | #10 | <clear> |
generic_name | #1 | rw | #10 | <clear> |
age | #1 | rw | #10 | <clear> |
Ancestry
Ancestors (nearest first): #1 Root Class
Children: none
Call graph
Source
init_order
Referenced by
- #42:battle line 11:
$combat:init_order
Source
1"$combat:init_order ( list ) this none this"; 2"returns list sorted by init rolls (attack order)"; 3"assumes that combatant.combat_weapon is set to something"; 4{combatants} = args; 5init_order = {}; 6for each in (combatants) 7each.combat_init = each:init_roll(each.combat_weapon); 8list_size = length(init_order); 9if (list_size == 0) 10init_order = {@init_order, each}; 11else 12x = 1; 13while ((init_order[x].combat_init < each.combat_init) && (x < list_size)) 14x = x + 1; 15endwhile 16if (each.combat_init <= init_order[x].combat_init) 17init_order = listinsert(init_order, each, x); 18elseif (x == list_size) 19init_order = {@init_order, each}; 20endif 21endif 22endfor 23return init_order;
battle
Referenced by
- #3:_attack line 15:
$combat:battle - #42:battle line 62:
$combat:battle
Source
1"$combat:battle( location ) this none this"; 2"forked by _attack() and/or itself"; 3"performs auto combat for animates in location"; 4{loc} = args; 5combatants = loc.combatants; 6"set weapon for this round"; 7for each in (combatants) 8each.combat_weapon = each:get_weapon(); 9endfor 10"arrange combatants in order of initiative roll"; 11combatants = $combat:init_order(combatants); 12for each in (combatants) 13each:lower_endurance($combat.end_per_round); 14each:tell(""); 15endfor 16for each in (combatants) 17if (each.combat_stance == "attack") 18targ = each:get_target(); 19if (targ != 0) 20each:hit(targ); 21else 22loc.combatants = setremove(loc.combatants, each); 23endif 24elseif (each.combat_stance == "passive") 25"do nothing"; 26for targ in (each.targets) 27if (targ.combat_stance != "attack") 28targ.targets = setremove(targ.targets, each); 29each.targets = setremove(each.targets, targ); 30endif 31endfor 32elseif (each.combat_stance == "flee") 33for targ in (each.targets) 34if (targ.combat_stance != "attack") 35targ.targets = setremove(targ.targets, each); 36each.targets = setremove(each.targets, targ); 37endif 38endfor 39viewers = each.location:get_animates(); 40viewers = setremove(viewers, each); 41for guy in (viewers) 42guy:sees(3, {each:known_to(guy)[2] + " attempts to flee, but can't escape."}); 43endfor 44each:tell("You attempt to flee, but can't escape."); 45elseif (each.combat_stance == "defend") 46"do nothing"; 47for targ in (each.targets) 48if (targ.combat_stance != "attack") 49targ.targets = setremove(targ.targets, each); 50each.targets = setremove(each.targets, targ); 51endif 52endfor 53endif 54if (each.targets == {}) 55combatants = setremove(combatants, each); 56endif 57"if neither is attacking, take out of targets"; 58endfor 59loc.combatants = combatants; 60if (loc.combatants != {}) 61fork pid ($combat.round_length) 62$combat:battle(loc); 63endfork 64loc.combat_pid = pid; 65else 66loc.combat_pid = 0; 67viewers = loc:get_animates(); 68for each in (viewers) 69each:sees(3, {"The fray has ended."}); 70endfor 71endif 72notify(#5, "Ticks left: " + tostr(ticks_left()));