本文整理汇总了C++中object::add_hp方法的典型用法代码示例。如果您正苦于以下问题:C++ object::add_hp方法的具体用法?C++ object::add_hp怎么用?C++ object::add_hp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::add_hp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: take_damage
int take_damage(object tp) {
if (present(tp)) {
tell_object(tp, "You feel weaker from the lack of oxygen.");
tp->add_hp(-10);
tp->add_sp(-5);
remove_call_out("take_damage");
call_out("take_damage", 120, tp);
return 1;
}
}
示例2: harm_player
int harm_player(object ob, int hp) {
if(!ob) return 0;
ob->add_hp(-hp);
ob->show_status_line();
if(ob->query_hp()<1) {
ob->set_hp(ob->query_max_hp());
player_death(ob);
return 0;
}
return 1;
}
示例3: soulwell
int soulwell( object vic, object att )
{
command( "say To me fiends! I crave your sustenence!" );
ansi_tell_room( ENV( att ), "A black mist comprised of "
"lost souls begins to rise from the ground. Rifrad breathes "
"deeply.", HIK );
att->add_hp( 30 + random( 30 ) );
return 1;
}
示例4: tick
void tick() {
if (!vict->query_is_living())
destruct(this_object());
switch (type) {
case "mana": vict->add_mana(speed); break;
case "endurance": vict->add_endurance(speed); break;
default: vict->add_hp(speed);
}
msg_object(vict,"You feel energy returning to your body.");
size -= speed;
if (speed >= size)
speed = size;
if (size <= 0)
destruct(this_object());
call_out("tick",5);
}
示例5: on_action
void on_action( object victim ) {
mixed result;
mapping wc;
int damage;
string buf = "";
if( !BATTLE_DAEMON->check_legal_melee(victim, "throatbite") )
return;
if (this_player()->query_endurance() >= 2)
this_player()->add_endurance(-2);
else {
msg("~CWRNYou are too tired to fight any more!~CDEF");
this_player()->add_readiness(-1000);
return;
}
wc = copy(this_player()->query_wc());
if (!mappingp(wc))
wc = (["piercing":7]);
wc["piercing"] += wc["edged"] +
this_player()->query_str_wc() +
this_player()->query_attitude("attack");
wc -= (["edged"]);
result = BATTLE_DAEMON->execute_melee(this_player(), wc, victim, 2, 0);
damage = result[RESULT_MOD];
switch (result[RESULT_TYPE]) {
case "miss":
buf = "~[130~Name ~verbsnap ~poss teeth centimeters from ~npot neck!";
break;
/*
case "block":
case "parry":
case "dodge":
if (damage)
buf = "~[130~Targ almost ~vert"+result[RESULT_TYPE]+" ~npos punch, but not quite.";
else
buf = "~[130~Targ ~vert"+result[RESULT_TYPE]+" ~npos punch!";
break;
case "hit":
case "counter":
*/
default:
if (damage > 10 && random(100) < 30-(victim->query_constitution())) {
buf = "~[090~Name ~verbtear ~npot throat wide open with a ferocious bite!";
victim->add_hp(-(victim->query_hp()));
break;
}
if (damage >= 15)
buf = "~[090~Name ~verbsink ~poss teeth into ~post neck!";
else if (damage > 0)
buf = "~[090~Name ~verbbite ~targ viciously on the shoulder!";
else
buf = "~[090~Name barely ~verbmanage to bite ~targ.";
break;
}
if (result[RESULT_MSG])
buf += "~[060 "+result[RESULT_MSG];
this_player()->add_readiness(-1700);
this_player()->msg_local(buf+"~CDEF");
}