attack #222
Aliases: attack
8 verbs · 20 properties · 0 children
Verbs
| Verb | Spec | Flags | Definer | Lines |
|---|---|---|---|---|
_start | this none this | rxd | #222 | 42 |
_finish | this none this | rxd | #222 | 74 |
maybe_reattack | this none this | rxd | #222 | 8 |
_forbidden | this none this | rxd | #222 | 1 |
combat_report_name | this none this | rxd | #222 | 8 |
render | this none this | rxd | #222 | 7 |
attack_action_target | this none this | rxd | #222 | 1 |
doing_msg | this none this | rxd | #222 | 6 |
Properties
| Property | Definer | Flags | Owner | Value |
|---|---|---|---|---|
is_attack_action | #222 | rc | #361 | 1 |
help_msg | #93 | rc | #361 | <clear> |
duration | #93 | rc | #361 | <clear> |
preemptible | #93 | rc | #361 | <clear> |
unstoppable | #93 | rc | #361 | <clear> |
dodge_mod | #93 | rc | #361 | <clear> |
doing_msg | #93 | rc | #361 | <clear> |
doing_to_msg | #93 | rc | #361 | <clear> |
oabort_msg | #93 | rc | #361 | <clear> |
can_parry | #93 | rc | #361 | <clear> |
aliases | #1 | rc | #361 | {"attack"} |
description | #1 | rc | #361 | <clear> |
object_size | #1 | r | #29 | {0, 0} |
hidden_verbs | #1 | rc | #361 | <clear> |
phelp_msg | #1 | rc | #361 | <clear> |
weight | #1 | rc | #361 | <clear> |
owner_verbs | #1 | rc | #361 | <clear> |
plural_name | #1 | rc | #361 | <clear> |
client_image | #1 | rc | #361 | <clear> |
listening | #1 | rc | #361 | <clear> |
Ancestry
Ancestors (nearest first): #93 Generic Action → #1 root
Children: none
Call graph
Source
_start
Referenced by
none
Source
1who = args[1]; 2obv_dobj = args[2][1]; 3if (!is_a(obv_dobj, $creature)) 4return E_NONE; 5endif 6dobj = obv_dobj:effective_target(who); 7if (!is_a(dobj, $creature)) 8return E_NONE; 9endif 10with = args[2][2]; 11bodypart = (length(args[2]) > 2) ? args[2][3] | dobj:random_bodypart(); 12if (who.location != dobj.location) 13return E_INVARG; 14endif 15who.location:broadcast_event(1, this, @args); 16whocover = who in who.location.covering; 17dobjcover = dobj in dobj.location.covering; 18bonus = 1; 19if (is_a(with, #102)) 20canreach = $rpg:reach(who, dobj, tostr("You come out from behind cover to attack with your ", with:name(), "."), tostr(who:dnamec(), "'s furious charge drives you out of your hiding place.")); 21else 22canreach = 1; 23endif 24who.last_dodge_time = 0; 25if (!(canreach && with:can_attack(who, dobj))) 26return {4.0, E_INVARG}; 27endif 28bonus = who:base_attack(bonus, with, dobj); 29if ((dark = who.location:darkness(0, who)) && ((!who:can_see_in_dark()) || (dark < 0))) 30bonus = bonus - (dark * 3); 31endif 32if ((dark < 2) || dobj:can_see_in_dark()) 33bonus = dobj:base_dodge(bonus, with, who); 34endif 35check = with:check_skill(who, bonus, 1); 36if ((!with:start_attack(who, dobj, check, bodypart)) || ((!dobj:reachable_by(who)) && (!is_a(who:weapon(), #284)))) 37who.fighting = setremove(who.fighting, obv_dobj); 38return {max(6.0 - (tofloat($skills.cool:total(who)) / 8.0), 2.0), E_INVARG}; 39endif 40speed = with:speed(who); 41speed = (speed + 0.5) - (tofloat(random(10)) / 10.0); 42return {speed, {check, bodypart}};
_finish
Referenced by
none
Source
1who = args[1]; 2obv_target = args[2][1]; 3if (!is_a(obv_target, $creature)) 4return; 5endif 6target = obv_target:effective_target(who); 7if (!is_a(target, $creature)) 8return E_NONE; 9endif 10with = args[2][2]; 11if ((((who.location != target.location) || (typeof(args[3]) == ERR)) || is_a(target, $corpse)) || (!is_a(with, $weapon))) 12return; 13endif 14result = args[3][1]; 15bodypart = args[3][2]; 16power = (length(args[3]) > 2) ? args[3][3] | 0; 17tv_msg = ""; 18with.skill:possibly_improve(who, result); 19if (result < 0) 20msg = with:miss_msg(who, target, result, 0, bodypart); 21msg = this:render(who, target, power, ($ansi.bold_on + $ansi.blue) + "/", $su:ps(msg, who, with, bodypart, target)); 22else 23result = target:dodge_or_parry(who, with, result, bodypart); 24if (typeof(result) == STR) 25"...target actively defended..."; 26msg = result; 27elseif (typeof(result) == LIST) 28"...target actively defended... (new format)"; 29msg = this:render(who, target, power, ($ansi.yellow + $ansi.bold_on) + result[1], result[2]); 30elseif (typeof(damage = with:inflict_damage(target, result, bodypart, who, power)) == STR) 31"...it was absorbed by armor..."; 32msg = this:render(who, target, power, ($ansi.blue + $ansi.bold_on) + "v", damage); 33else 34"...we scored a hit!"; 35"if (((((target.health <= 0) && (who.fight_style > 1)) && valid(fatal = with.fatalities)) && is_a(target, $creature)) && fatal:fatality(who, with, target, bodypart, damage))"; 36" \"...FATALITY!\";"; 37" msg = \"\";"; 38" #414917:add_progress(who);"; 39"else"; 40if ((is_a(with, $weapon) && is_a(with.noise, $noise)) && (random(100) < 10)) 41who.location:make_noise(with.noise, who); 42endif 43meter = $rpg:mini_damage(damage, target.health_max); 44msg_mine = with:hit_msg(who, target, result, damage, bodypart); 45"if (msg_yours = target:squeal_msg(damage, bodypart))"; 46" msg_yours = $su:capitalize($su:ps(msg_yours, target));"; 47" pattern = random(3);"; 48" if (pattern == 1)"; 49" msg = (msg_yours + \"; \") + $su:ps($rpg:_ihm(msg_mine, target), who, with, bodypart, target);"; 50" elseif (pattern == 2)"; 51" msg = (msg_yours + \" when \") + $su:ps($rpg:_ihm(msg_mine, target), who, with, bodypart, target);"; 52" elseif (pattern == 3)"; 53" msg = (msg_yours + \" as \") + $su:ps($rpg:_ihm(msg_mine, target), who, with, bodypart, target);"; 54" elseif (pattern == 4)"; 55" msg = (msg_yours + \"! \") + $su:capitalize($su:ps(msg_mine, who, with, bodypart, target));"; 56" endif"; 57"else"; 58msg = $su:capitalize($su:ps(msg_mine, who, with, bodypart, target)); 59"endif"; 60if (is_a(bodypart, #25749) && (is_a(with, #135) || is_a(with, #842))) 61tv_msg = msg; 62endif 63msg = this:render(who, target, power, meter, msg); 64"endif"; 65endif 66endif 67if (msg) 68if (tv_msg) 69#47065:report({$su:capitalize(tv_msg)}); 70endif 71who:aat(msg); 72endif 73with:finish_attack(who, target); 74who.location:broadcast_event(0, this, @args);
maybe_reattack
Referenced by
none
Source
1who = args[1]; 2dobj = args[2]; 3with = args[3]; 4if (dobj.location == who.location) 5if (!who.action_queue) 6with:attack(); 7endif 8endif
_forbidden
Referenced by
none
Source
1args[1].fighting = setremove(args[1].fighting, args[2][1]);
combat_report_name
Referenced by
- #222:render line 3:
this:combat_report_name - #222:render line 4:
this:combat_report_name
Source
1who = args[1]; 2if (is_a(who, $player) && (!who.programmer)) 3return (($ansi.green + $ansi.bold_on) + who.name[1]) + $ansi.reset; 4elseif (is_a(who, $immortal) && who.code_name) 5return (($ansi.cyan + $ansi.bold_on) + who.code_name[1]) + $ansi.reset; 6else 7return (($ansi.cyan + $ansi.bold_on) + who.name[1]) + $ansi.reset; 8endif
render
Referenced by
- #222:_finish line 21:
this:render - #222:_finish line 29:
this:render - #222:_finish line 32:
this:render - #222:_finish line 63:
this:render
Source
1"Copied from code holder (#404418):render by Irony (#413385) Sun Aug 8 00:43:22 2010 CDT"; 2{who, target, power, symbol, msg} = args[1..5]; 3whoi = this:combat_report_name(who); 4tari = this:combat_report_name(target); 5health_color = $ansi.((is_a(target, $player) && (!who.programmer)) ? "green" | "cyan"); 6bracket_color = $ansi.(power ? "red" | "white") + $ansi.bold_on; 7return tostr(((((((((bracket_color + "[") + $ansi.reset) + whoi) + symbol) + $ansi.reset) + tari) + bracket_color) + "][") + health_color, $su:right((target.health < 1) ? 0 | max(1, toint((tofloat(target.health) / tofloat(target.health_max)) * 100.0)), 6 - length($ansi:strip(symbol))), (("%" + bracket_color) + "] ") + $ansi.reset, msg);
attack_action_target
Referenced by
none
Source
1return args[2][1];
doing_msg
Referenced by
none
Source
1{who, actionargs} = args; 2if ((!actionargs) || (!gamevalid(actionargs[1]))) 3return $su:ps(this.doing_msg, who, this, #-1, #-1, #-1); 4else 5return $su:ps(this.doing_to_msg, who, this, actionargs[1], #-1, #-1); 6endif