本文整理汇总了C++中damage函数的典型用法代码示例。如果您正苦于以下问题:C++ damage函数的具体用法?C++ damage怎么用?C++ damage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了damage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: do_earthshatter
void do_earthshatter( CHAR_DATA *ch, char *argument)
{
CHAR_DATA *vch;
CHAR_DATA *vch_next;
int dam;
int level;
if (IS_NPC(ch)) return;
if (!IS_CLASS(ch, CLASS_DROW) || !IS_SET(ch->pcdata->powers[1], DPOWER_EARTHSHATTER)) {
send_to_char("Huh?\n\r", ch );
return;}
if (ch->mana < 150) {
send_to_char("You need more mana.\n\r", ch );
return;}
level = ch->spl[PURPLE_MAGIC];
ch->mana -= 150;
send_to_char("You summon the power of the underworld, shattering the earth.\n\r", ch );
act("$n causes the earth to shatter",ch,NULL,NULL,TO_ROOM);
for ( vch = ch->in_room->people; vch != NULL; vch = vch_next )
{
vch_next = vch->next_in_room;
if (vch == ch) continue;
if (vch->trust>6) continue;
dam = dice(level, 7 );
if ( saves_spell( level, vch ) )
dam /= 2;
damage( ch, vch, dam, skill_lookup("earthquake"));
}
WAIT_STATE(ch, 12);
return;
}
开发者ID:smthbh,项目名称:dystopia-mud,代码行数:38,代码来源:drow.c
示例2: getSize
//--------------------------------------------------------------
// mouse pressed
void mgSimpleDesktop::mouseDown(
void* source,
int x,
int y,
int modifiers,
int button)
{
#ifdef WORKED
// takeKeyFocus();
mgDimension size;
getSize(size);
mgRectangle inside(0, 0, size.m_width, size.m_height);
if (m_upFrame != NULL)
m_upFrame->getInsideRect(inside);
// =-= select entry under point
y = y - inside.m_y;
int index = (y/m_lineHeight) + m_scrollPosn;
if (index < m_entries.length())
{
if (m_multiSelect)
{
// =-= shift select, cntl select, start of drag select
// =-= reset all other selections if just click
mgListEntry* entry = (mgListEntry*) m_entries.getAt(index);
entry->m_selected = true;
}
else
{
m_selected = index;
}
damage();
}
#endif
}
开发者ID:Kelimion,项目名称:SeaOfMemes,代码行数:40,代码来源:mgSimpleDesktop.cpp
示例3: send_to_char
void Character::spell_earthquake (int sn, int lvl, void *vo)
{
send_to_char ("The earth trembles beneath your feet!\r\n");
act ("$n makes the earth tremble and shiver.", NULL, NULL, TO_ROOM);
CharIter c, next;
for (c = char_list.begin(); c != char_list.end(); c = next) {
Character* vch = *c;
next = ++c;
if (vch->in_room == NULL)
continue;
if (vch->in_room == in_room) {
if (vch != this && (is_npc () ? !vch->is_npc () : vch->is_npc ()))
damage (this, vch, lvl + dice (2, 8), sn);
continue;
}
if (vch->in_room->area == in_room->area)
vch->send_to_char ("The earth trembles and shivers.\r\n");
}
return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:23,代码来源:spells.cpp
示例4: notify_all
void Text::eraseLine()
{
if (insertion_.line_ < text_->Height())
{
int oldWidth = text_->Width();
int index0 = text_->LineIndex(insertion_.line_);
int index1 = text_->BeginningOfNextLine(index0);
// ---- delete the text ----
text_->Delete(index0, index1 - index0);
// --- check for width change ----
if (text_->Width() != oldWidth)
{
needWidth_ = true;
notify_all();
}
}
insertion_.column_ = 0;
repair();
damage(insertion_);
repair();
}
开发者ID:PNCG,项目名称:neuron,代码行数:23,代码来源:iv3text.cpp
示例5: number_range
/*
* Drain XP, MANA, HP.
* Caster gains HP.
*/
void Character::spell_energy_drain (int sn, int lvl, void *vo)
{
Character *victim = (Character *) vo;
int dam;
if (victim->saves_spell (lvl))
return;
alignment = std::max (-1000, alignment - 200);
if (victim->level <= 2) {
dam = hit + 1;
} else {
victim->gain_exp(0 - number_range (lvl / 2, 3 * lvl / 2));
victim->mana /= 2;
victim->move /= 2;
dam = dice (1, lvl);
hit += dam;
}
damage (this, victim, dam, sn);
return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:27,代码来源:spells.cpp
示例6: act
void Character::spell_dispel_evil (int sn, int lvl, void *vo)
{
Character *victim = (Character *) vo;
if (!is_npc () && is_evil ())
victim = this;
if (victim->is_good ()) {
act ("God protects $N.", NULL, victim, TO_ROOM);
return;
}
if (victim->is_neutral ()) {
act ("$N does not seem to be affected.", NULL, victim, TO_CHAR);
return;
}
int dam = dice (lvl, 4);
if (victim->saves_spell (lvl))
dam /= 2;
damage (this, victim, dam, sn);
return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:23,代码来源:spells.cpp
示例7: w
void Fl_Sparkline::draw(void)
{
int i;
int index;
width = w() - padding * 2;
height = h() - padding * 2;
if (num_values == 0) {
draw_box();
return;
}
if (damage() == FL_DAMAGE_USER1) {
index = num_values * (Fl::event_x() - x() - padding) / width;
index = snap(index);
tip->position(Fl::event_x_root() + 10, Fl::event_y_root() + 10);
tip->value(values[index]);
tip->show();
drawCursor();
return;
}
draw_box();
fl_color(FL_BLACK);
drawPeaks();
fl_color(FL_BLACK);
for (i = 0; i < width; i++) {
drawPoint(i);
}
draw_label();
}
开发者ID:qartis,项目名称:dori,代码行数:37,代码来源:sparkline.cpp
示例8: switch
void Character::spell_frost_breath (int sn, int lvl, void *vo)
{
Character *victim = (Character *) vo;
if (number_percent () < 2 * lvl && !victim->saves_spell (lvl)) {
Object *obj_lose;
ObjIter o, onext;
for (o = victim->carrying.begin(); o != victim->carrying.end(); o = onext) {
obj_lose = *o;
onext = ++o;
const char *msg;
if (number_percent() <= 75)
continue;
switch (obj_lose->item_type) {
default:
continue;
case ITEM_CONTAINER:
case ITEM_DRINK_CON:
case ITEM_POTION:
msg = "$p freezes and shatters!";
break;
}
victim->act (msg, obj_lose, NULL, TO_CHAR);
obj_lose->extract_obj ();
}
}
int hpch = std::max (10, hit);
int dam = number_range (hpch / 16 + 1, hpch / 8);
if (victim->saves_spell (lvl))
dam /= 2;
damage (this, victim, dam, sn);
return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:37,代码来源:spells.cpp
示例9: letter
//--------------------------------------------------------------
// character typed
void mgSimpleField::keyChar(
void* source,
int keyCode,
int modifiers)
{
if (!iswprint(keyCode) && keyCode != ' ')
return; // non-letter key
WCHAR keyChar[2];
keyChar[0] = (WCHAR) keyCode;
keyChar[1] = '\0';
mgString letter(keyChar);
if (m_insertMode)
{
// extend string up to cursor position
while (m_text.length() < m_cursorPosn)
m_text += " ";
// insert character at cursor
m_text.insertAt(m_cursorPosn, letter);
}
else
{
// extend string, including cursor position
while (m_text.length() <= m_cursorPosn)
m_text += " ";
// replace current character
m_text.setLetter(m_cursorPosn, letter);
}
m_cursorPosn = m_text.nextLetter(m_cursorPosn);
updateScrollPosn();
m_changed = true;
damage();
}
开发者ID:Kelimion,项目名称:SeaOfMemes,代码行数:39,代码来源:mgSimpleField.cpp
示例10: getSize
//--------------------------------------------------------------
// mouse moved
void mgUglyList::mouseMove(
void* source,
int x,
int y,
int modifiers)
{
mgDimension size;
getSize(size);
mgRectangle inside(0, 0, size.m_width, size.m_height);
if (m_upFrame != NULL)
m_upFrame->getInsideRect(inside);
// find entry under point
y = y - inside.m_y;
int index = (y/m_lineHeight) + m_scrollPosn;
if (index < m_entries.length())
{
m_hover = index;
damage();
}
else m_hover = -1;
}
开发者ID:duaneking,项目名称:SeaOfMemes,代码行数:26,代码来源:mgUglyList.cpp
示例11: warp
void
warp(int fl, int c, double d)
{
int course;
double power;
double dist;
double p_time;
double speed;
double frac;
int percent;
int i;
char *s;
if (Ship.cond == DOCKED) {
printf("%s is docked\n", Ship.shipname);
return;
}
if (damaged(WARP)) {
out(WARP);
return;
}
course = c;
dist = d;
/* check to see that we are not using an absurd amount of power */
power = (dist + 0.05) * Ship.warp3;
percent = 100 * power / Ship.energy + 0.5;
if (percent >= 85) {
printf("Scotty: That would consume %d%% of our remaining energy.\n",
percent);
if (!getynpar("Are you sure that is wise"))
return;
}
/* compute the speed we will move at, and the time it will take */
speed = Ship.warp2 / Param.warptime;
p_time = dist / speed;
/* check to see that that value is not ridiculous */
percent = 100 * p_time / Now.time + 0.5;
if (percent >= 85) {
printf("Spock: That would take %d%% of our remaining time.\n",
percent);
if (!getynpar("Are you sure that is wise"))
return;
}
/* compute how far we will go if we get damages */
if (Ship.warp > 6.0 && ranf(100) < 20 + 15 * (Ship.warp - 6.0)) {
frac = franf();
dist *= frac;
p_time *= frac;
damage(WARP, (frac + 1.0) * Ship.warp * (franf() + 0.25) * 0.20);
}
/* do the move */
Move.time = move(fl, course, p_time, speed);
/* see how far we actually went, and decrement energy appropriately */
dist = Move.time * speed;
Ship.energy -= dist * Ship.warp3 * (Ship.shldup + 1);
/* test for bizarre events */
if (Ship.warp <= 9.0)
return;
printf("\n\n ___ Speed exceeding warp nine ___\n\n");
sleep(2);
printf("Ship's safety systems malfunction\n");
sleep(2);
printf("Crew experiencing extreme sensory distortion\n");
sleep(4);
if (ranf(100) >= 100 * dist) {
printf("Equilibrium restored -- all systems normal\n");
return;
}
/* select a bizzare thing to happen to us */
percent = ranf(100);
if (percent < 70) {
/* time warp */
if (percent < 35 || !Game.snap) {
/* positive time warp */
p_time = (Ship.warp - 8.0) * dist * (franf() + 1.0);
Now.date += p_time;
printf("Positive time portal entered -- it is now Stardate %.2f\n",
Now.date);
for (i = 0; i < MAXEVENTS; i++) {
percent = Event[i].evcode;
if (percent == E_FIXDV || percent == E_LRTB)
Event[i].date += p_time;
}
return;
}
/* s/he got lucky: a negative time portal */
p_time = Now.date;
s = Etc.snapshot;
bmove(s, Quad, sizeof Quad);
bmove(s += sizeof Quad, Event, sizeof Event);
bmove(s += sizeof Event, &Now, sizeof Now);
//.........这里部分代码省略.........
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:101,代码来源:warp.c
示例12: damage
void Character::spell_cause_serious (int sn, int lvl, void *vo)
{
damage (this, (Character *) vo, dice (2, 8) + lvl / 2, sn);
return;
}
开发者ID:MUDOmnibus,项目名称:Merc22-for-Cpp,代码行数:5,代码来源:spells.cpp
示例13: switch
//.........这里部分代码省略.........
}
break;
}
case EVENT_ENEMY_DESTROYED: {
struct SEnemyDestroyedEvent* evt = (struct SEnemyDestroyedEvent*) data;
if(evt->enemy < 0){
game->SendToConsole("shard-runtime warning: enemydestroyed evt->unit < 0");
break;
}
CSpringUnit* u = game->GetUnitById(evt->enemy);
if (!u) {
u = game->CreateUnit(evt->enemy);
}
/*if(u){
// @TODO: Add enemy dead event
game->Me()->UnitDead(u);
}*/
game->DestroyUnit(evt->enemy);
break;
}
case EVENT_ENEMY_CREATED: {
struct SEnemyCreatedEvent* evt = (struct SEnemyCreatedEvent*) data;
game->CreateUnit(evt->enemy);
break;
}
case EVENT_ENEMY_FINISHED: {
struct SEnemyFinishedEvent* evt = (struct SEnemyFinishedEvent*) data;
game->CreateUnit(evt->enemy);
break;
}
case EVENT_UNIT_DAMAGED: {
struct SUnitDamagedEvent* evt = (struct SUnitDamagedEvent*) data;
if(evt->unit < 0){
game->SendToConsole("shard-runtime warning: unitdamaged evt->unit < 0");
break;
}
CSpringDamage::Ptr damage(new CSpringDamage(game, callback, evt));
CSpringUnit* u = game->GetUnitById(evt->unit);
if (!u) {
u = game->CreateUnit(evt->unit);
}
//attacker is allowed to be -1 if attacker cannot be seen or determined.
CSpringUnit* a = NULL;
if (evt->attacker >= 0) {
a = game->GetUnitById(evt->attacker);
if (!a) {
game->CreateUnit(evt->attacker);
}
}
if(u) {
game->Me()->UnitDamaged(u,a,damage);
} else {
if (!u)
game->SendToConsole("shard-runtime warning: attacked unit not found.");
}
break;
}
case EVENT_UNIT_IDLE: {
struct SUnitIdleEvent* evt = (struct SUnitIdleEvent*) data;
if(evt->unit < 0){
game->SendToConsole("shard-runtime warning: unitidle evt->unit < 0");
break;
}
CSpringUnit* u = game->GetUnitById(evt->unit);
开发者ID:pandaro,项目名称:Shard,代码行数:67,代码来源:CppTestAI.cpp
示例14: damage
//--------------------------------------------------------------------
// damage entire bitmap
void mgGenSurface::damageAll()
{
damage(0, 0, m_surfaceWidth, m_surfaceHeight);
}
开发者ID:Kelimion,项目名称:SeaOfMemes,代码行数:6,代码来源:mgGenSurface.cpp
示例15: mag_damage
/*
* Every spell that does damage comes through here. This calculates the
* amount of damage, adds in any modifiers, determines what the saves are,
* tests for save and calls damage().
*
* -1 = dead, otherwise the amount of damage done.
*/
int mag_damage(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype)
{
int dam = 0;
if (victim == NULL || ch == NULL)
return (0);
switch (spellnum) {
/* Mostly mages */
case SPELL_MAGIC_MISSILE:
case SPELL_CHILL_TOUCH: /* chill touch also has an affect */
if (IS_MAGIC_USER(ch))
dam = dice(1, 8) + 1;
else
dam = dice(1, 6) + 1;
break;
case SPELL_BURNING_HANDS:
if (IS_MAGIC_USER(ch))
dam = dice(3, 8) + 3;
else
dam = dice(3, 6) + 3;
break;
case SPELL_SHOCKING_GRASP:
if (IS_MAGIC_USER(ch))
dam = dice(5, 8) + 5;
else
dam = dice(5, 6) + 5;
break;
case SPELL_LIGHTNING_BOLT:
if (IS_MAGIC_USER(ch))
dam = dice(7, 8) + 7;
else
dam = dice(7, 6) + 7;
break;
case SPELL_COLOR_SPRAY:
if (IS_MAGIC_USER(ch))
dam = dice(9, 8) + 9;
else
dam = dice(9, 6) + 9;
break;
case SPELL_FIREBALL:
if (IS_MAGIC_USER(ch))
dam = dice(11, 8) + 11;
else
dam = dice(11, 6) + 11;
break;
/* Mostly clerics */
case SPELL_DISPEL_EVIL:
dam = dice(6, 8) + 6;
if (IS_EVIL(ch)) {
victim = ch;
dam = GET_HIT(ch) - 1;
} else if (IS_GOOD(victim)) {
act("The gods protect $N.", FALSE, ch, 0, victim, TO_CHAR);
return (0);
}
break;
case SPELL_DISPEL_GOOD:
dam = dice(6, 8) + 6;
if (IS_GOOD(ch)) {
victim = ch;
dam = GET_HIT(ch) - 1;
} else if (IS_EVIL(victim)) {
act("The gods protect $N.", FALSE, ch, 0, victim, TO_CHAR);
return (0);
}
break;
case SPELL_CALL_LIGHTNING:
dam = dice(7, 8) + 7;
break;
case SPELL_HARM:
dam = dice(8, 8) + 8;
break;
case SPELL_ENERGY_DRAIN:
if (GET_LEVEL(victim) <= 2)
dam = 100;
else
dam = dice(1, 10);
break;
/* Area spells */
case SPELL_EARTHQUAKE:
dam = dice(2, 8) + level;
break;
} /* switch(spellnum) */
//.........这里部分代码省略.........
开发者ID:Yuffster,项目名称:CircleMUD,代码行数:101,代码来源:magic.c
示例16: set_damage
void Fl_Overlay_Window::redraw_overlay()
{
overlay_ = this;
set_damage(damage()|FL_DAMAGE_OVERLAY);
Fl::damage(FL_DAMAGE_CHILD);
}
开发者ID:edeproject,项目名称:efltk,代码行数:6,代码来源:Fl_Overlay_Window.cpp
示例17: bounce
void Player::bounce(Player * other) {
SDL_Rect * rect, * source;
rect = last_position;
source = other->last_position;
int l, r, t, b;
int ls, rs, ts, bs;
bool is_above, is_below;
bool is_left, is_right;
l = rect->x;
t = rect->y;
r = rect->x + rect->w;
b = rect->y + rect->h;
ls = source->x;
ts = source->y;
rs = source->x + source->w;
bs = source->y + source->h;
if(l - ls > (WINDOW_WIDTH / 2)) {
ls += WINDOW_WIDTH;
rs += WINDOW_WIDTH;
}
if(ls - l > (WINDOW_WIDTH / 2)) {
l += WINDOW_WIDTH;
r += WINDOW_WIDTH;
}
is_above = (b <= ts);
is_below = (t >= bs);
is_left = (r <= ls);
is_right = (l >= rs);
if(!is_above && !is_below && !is_left && !is_right) {
if(bounce_direction_y == -1) is_above = true;
if(bounce_direction_y == 1) is_below = true;
if(bounce_direction_x == -1) is_left = true;
if(bounce_direction_x == 1) is_right = true;
}
// Players hit each others top
if(is_above) {
bounce_direction_y = -1;
if(input->is_pressed(A_JUMP)) {
Main::audio->play(SND_JUMP, position->x);
momentumy = MAX_MOMENTUM_JUMP;
is_falling = false;
is_jumping = true;
} else {
momentumy = 30;
}
}
if(is_below) {
bounce_direction_y = 1;
is_duck_forced = true;
duck_force_start = Gameplay::frame;
momentumy = -10;
if(damage(WEIGHTCLASSES[other->weightclass].headjump_damage)) {
other->headstomps++;
}
}
if(!is_above && !is_below) {
bounce_direction_y = 0;
}
newmomentumx = momentumx;
// Players hit each others side
if(is_left || is_right) {
newmomentumx = other->momentumx;
if(is_left) {
bounce_direction_x = -1;
newmomentumx -= WEIGHTCLASSES[other->weightclass].push_force - WEIGHTCLASSES[weightclass].push_force + 10;
}
if(is_right) {
bounce_direction_x = 1;
newmomentumx += WEIGHTCLASSES[other->weightclass].push_force - WEIGHTCLASSES[weightclass].push_force + 10;
}
} else {
bounce_direction_x = 0;
}
}
开发者ID:JordyMoos,项目名称:smashbattle,代码行数:84,代码来源:Player.cpp
示例18: damage
//--------------------------------------------------------------
// set default text color
void mgFormPane::setDefaultTextColor(
const mgColor& color)
{
m_defaultTextColor = color;
damage();
}
开发者ID:Kelimion,项目名称:SeaOfMemes,代码行数:8,代码来源:mgFormPane.cpp
示例19: attack
/* argument is set if attack while resting */
void
attack(int resting)
{
int hit, i, l;
int maxhit, tothit, shldabsb;
double chgfac, propor, extradm;
double dustfac, tothe;
int cas;
int hitflag;
if (Move.free)
return;
if (Etc.nkling <= 0 || Quad[Ship.quadx][Ship.quady].stars < 0)
return;
if (Ship.cloaked && Ship.cloakgood)
return;
/* move before attack */
klmove(0);
if (Ship.cond == DOCKED)
{
if (!resting)
printf("Starbase shields protect the %s\n", Ship.shipname);
return;
}
/* setup shield effectiveness */
chgfac = 1.0;
if (Move.shldchg)
chgfac = 0.25 + 0.50 * franf();
maxhit = tothit = 0;
hitflag = 0;
/* let each Klingon do his damndest */
for (i = 0; i < Etc.nkling; i++)
{
/* if he's low on power he won't attack */
if (Etc.klingon[i].power < 20)
continue;
if (!hitflag)
{
printf("\nStardate %.2f: Klingon attack:\n",
Now.date);
hitflag++;
}
/* complete the hit */
dustfac = 0.90 + 0.01 * franf();
tothe = Etc.klingon[i].avgdist;
hit = Etc.klingon[i].power * pow(dustfac, tothe) * Param.hitfac;
/* deplete his energy */
dustfac = Etc.klingon[i].power;
Etc.klingon[i].power = dustfac * Param.phasfac * (1.0 + (franf() - 0.5) * 0.2);
/* see how much of hit shields will absorb */
shldabsb = 0;
if (Ship.shldup || Move.shldchg)
{
propor = Ship.shield;
propor /= Param.shield;
shldabsb = propor * chgfac * hit;
if (shldabsb > Ship.shield)
shldabsb = Ship.shield;
Ship.shield -= shldabsb;
}
/* actually do the hit */
printf("\aHIT: %d units", hit);
if (!damaged(SRSCAN))
printf(" from %d,%d", Etc.klingon[i].x, Etc.klingon[i].y);
cas = (shldabsb * 100) / hit;
hit -= shldabsb;
if (shldabsb > 0)
printf(", shields absorb %d%%, effective hit %d\n",
cas, hit);
else
printf("\n");
tothit += hit;
if (hit > maxhit)
maxhit = hit;
Ship.energy -= hit;
/* see if damages occurred */
if (hit >= (15 - Game.skill) * (25 - ranf(12)))
{
printf("\aCRITICAL HIT!!!\a\n");
/* select a device from probability vector */
cas = ranf(1000);
for (l = 0; cas >= 0; l++)
cas -= Param.damprob[l];
l -= 1;
/* compute amount of damage */
extradm = (hit * Param.damfac[l]) / (75 + ranf(25)) + 0.5;
/* damage the device */
damage(l, extradm);
if (damaged(SHIELD))
{
if (Ship.shldup)
printf("Sulu: Shields knocked down, captain.\n");
Ship.shldup = 0;
Move.shldchg = 0;
}
}
if (Ship.energy <= 0)
lose(L_DSTRYD);
//.........这里部分代码省略.........
开发者ID:a565109863,项目名称:src,代码行数:101,代码来源:attack.c
示例20: point_update
/* Update PCs, NPCs, and objects */
void point_update(void)
{
struct char_data *i, *next_char;
struct obj_data *j, *next_thing, *jj, *next_thing2;
/* characters */
for (i = character_list; i; i = next_char) {
next_char = i->next;
gain_condition(i, FULL, -1);
gain_condition(i, DRUNK, -1);
gain_condition(i, THIRST, -1);
if (GET_POS(i) >= POS_STUNNED) {
GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i));
GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i));
GET_MOVE(i) = MIN(GET_MOVE(i) + move_gain(i), GET_MAX_MOVE(i));
if (AFF_FLAGGED(i, AFF_POISON))
if (damage(i, i, 2, SPELL_POISON) == -1)
continue; /* Oops, they died. -gg 6/24/98 */
if (GET_POS(i) <= POS_STUNNED)
update_pos(i);
} else if (GET_POS(i) == POS_INCAP) {
if (damage(i, i, 1, TYPE_SUFFERING) == -1)
continue;
} else if (GET_POS(i) == POS_MORTALLYW) {
if (damage(i, i, 2, TYPE_SUFFERING) == -1)
continue;
}
if (!IS_NPC(i)) {
update_char_objects(i);
if (GET_LEVEL(i) < idle_max_level)
check_idling(i);
}
}
/* objects */
for (j = object_list; j; j = next_thing) {
next_thing = j->next; /* Next in object list */
/* If this is a corpse */
if (IS_CORPSE(j)) {
/* timer count down */
if (GET_OBJ_TIMER(j) > 0)
GET_OBJ_TIMER(j)--;
if (!GET_OBJ_TIMER(j)) {
if (j->carried_by)
act("$p decays in your hands.", FALSE, j->carried_by, j, 0, TO_CHAR);
else if ((IN_ROOM(j) != NOWHERE) && (world[IN_ROOM(j)].people)) {
act("A quivering horde of maggots consumes $p.",
TRUE, world[IN_ROOM(j)].people, j, 0, TO_ROOM);
act("A quivering horde of maggots consumes $p.",
TRUE, world[IN_ROOM(j)].people, j, 0, TO_CHAR);
}
for (jj = j->contains; jj; jj = next_thing2) {
next_thing2 = jj->next_content; /* Next in inventory */
obj_from_obj(jj);
if (j->in_obj)
obj_to_obj(jj, j->in_obj);
else if (j->carried_by)
obj_to_room(jj, IN_ROOM(j->carried_by));
else if (IN_ROOM(j) != NOWHERE)
obj_to_room(jj, IN_ROOM(j));
else
core_dump();
}
extract_obj(j);
}
}
/* If the timer is set, count it down and at 0, try the trigger */
/* note to .rej hand-patchers: make this last in your point-update() */
else if (GET_OBJ_TIMER(j)>0) {
GET_OBJ_TIMER(j)--;
if (!GET_OBJ_TIMER(j))
timer_otrigger(j);
}
}
}
开发者ID:matthewbode,项目名称:mg2,代码行数:82,代码来源:limits.c
注:本文中的damage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论