--- deliantra/server/server/spell_effect.C 2010/04/04 04:10:47 1.123 +++ deliantra/server/server/spell_effect.C 2010/04/11 00:34:06 1.124 @@ -105,9 +105,9 @@ wand->stats.food += ncharges; new_draw_info_format (NDI_UNIQUE, 0, op, "The %s glows with power.", query_name (wand)); - if (wand->arch && QUERY_FLAG (wand->arch, FLAG_ANIMATE)) + if (wand->arch && wand->arch->flag [FLAG_ANIMATE]) { - SET_FLAG (wand, FLAG_ANIMATE); + wand->set_flag (FLAG_ANIMATE); wand->set_speed (wand->arch->speed); } @@ -131,7 +131,7 @@ const char *missile_name = "arrow"; for (object *tmp = op->inv; tmp; tmp = tmp->below) - if (tmp->type == BOW && QUERY_FLAG (tmp, FLAG_APPLIED)) + if (tmp->type == BOW && tmp->flag [FLAG_APPLIED]) missile_name = tmp->race; int missile_plus = spell->stats.dam + SP_level_dam_adjust (caster, spell); @@ -195,7 +195,7 @@ /* Can't get any money for these objects */ missile->value = 0; - SET_FLAG (missile, FLAG_IDENTIFIED); + missile->set_flag (FLAG_IDENTIFIED); if (!cast_create_obj (op, caster, missile, dir) && op->type == PLAYER && !missile->destroyed ()) pick_up (op, missile); @@ -299,7 +299,7 @@ if (mflags & P_OUT_OF_MAP) break; - if (!QUERY_FLAG (op, FLAG_WIZCAST) && (mflags & P_NO_MAGIC)) + if (!op->flag [FLAG_WIZCAST] && (mflags & P_NO_MAGIC)) { new_draw_info (NDI_UNIQUE, 0, op, "Something blocks your magic."); return 0; @@ -308,7 +308,7 @@ if (mflags & P_IS_ALIVE) { for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) - if (QUERY_FLAG (tmp, FLAG_ALIVE) && (tmp->type == PLAYER || QUERY_FLAG (tmp, FLAG_MONSTER))) + if (tmp->flag [FLAG_ALIVE] && (tmp->type == PLAYER || tmp->flag [FLAG_MONSTER])) { new_draw_info (NDI_UNIQUE, 0, op, "You detect something."); if (tmp->head != NULL) @@ -341,7 +341,7 @@ /* If race isn't set, then invisible unless it is undead */ if (!pl->contr->invis_race) { - if (QUERY_FLAG (mon, FLAG_UNDEAD)) + if (mon->flag [FLAG_UNDEAD]) return 0; return 1; @@ -398,7 +398,7 @@ { op->contr->invis_race = spell_ob->race; - if (QUERY_FLAG (spell_ob, FLAG_MAKE_INVIS)) + if (spell_ob->flag [FLAG_MAKE_INVIS]) op->contr->tmp_invis = 0; else op->contr->tmp_invis = 1; @@ -450,7 +450,7 @@ { next = tmp->above; - if (QUERY_FLAG (tmp, FLAG_TEAR_DOWN)) + if (tmp->flag [FLAG_TEAR_DOWN]) hit_player (tmp, 9998, op, AT_PHYSICAL, 0); } } @@ -463,7 +463,7 @@ { if (object *pl = op->in_player ()) { - if (pl->ms ().flags () & P_NO_CLERIC && !QUERY_FLAG (pl, FLAG_WIZCAST)) + if (pl->ms ().flags () & P_NO_CLERIC && !pl->flag [FLAG_WIZCAST]) new_draw_info (NDI_UNIQUE, 0, pl, "You feel something fizzle inside you."); else pl->player_goto (op->slaying, op->stats.hp, op->stats.sp); @@ -681,24 +681,24 @@ tmp->stats.dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); tmp->range = 0; } - else if (QUERY_FLAG (tmp, FLAG_ALIVE)) + else if (tmp->flag [FLAG_ALIVE]) { tmp->stats.hp = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); tmp->stats.maxhp = tmp->stats.hp; } - if (QUERY_FLAG (spell_ob, FLAG_IS_USED_UP) || QUERY_FLAG (tmp, FLAG_IS_USED_UP)) + if (spell_ob->flag [FLAG_IS_USED_UP] || tmp->flag [FLAG_IS_USED_UP]) { tmp->stats.food = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob); - SET_FLAG (tmp, FLAG_IS_USED_UP); + tmp->set_flag (FLAG_IS_USED_UP); } - if (QUERY_FLAG (spell_ob, FLAG_TEAR_DOWN)) + if (spell_ob->flag [FLAG_TEAR_DOWN]) { tmp->stats.hp = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); tmp->stats.maxhp = tmp->stats.hp; - SET_FLAG (tmp, FLAG_TEAR_DOWN); - SET_FLAG (tmp, FLAG_ALIVE); + tmp->set_flag (FLAG_TEAR_DOWN); + tmp->set_flag (FLAG_ALIVE); } /* This can't really hurt - if the object doesn't kill anything, @@ -773,7 +773,7 @@ negblocked = 1; } - if (QUERY_FLAG (tmp, FLAG_BLOCKSVIEW)) + if (tmp->flag [FLAG_BLOCKSVIEW]) update_all_los (op->map, op->x, op->y); return 1; @@ -1105,7 +1105,7 @@ force->speed = 1.0; force->speed_left = -1.0; - SET_FLAG (force, FLAG_APPLIED); + force->set_flag (FLAG_APPLIED); /* Now start processing the effects. First, protections */ for (i = 0; i < NROFATTACKS; i++) @@ -1145,11 +1145,11 @@ force->move_type = spell_ob->move_type; - if (QUERY_FLAG (spell_ob, FLAG_SEE_IN_DARK)) - SET_FLAG (force, FLAG_SEE_IN_DARK); + if (spell_ob->flag [FLAG_SEE_IN_DARK]) + force->set_flag (FLAG_SEE_IN_DARK); - if (QUERY_FLAG (spell_ob, FLAG_XRAYS)) - SET_FLAG (force, FLAG_XRAYS); + if (spell_ob->flag [FLAG_XRAYS]) + force->set_flag (FLAG_XRAYS); /* Haste/bonus speed */ if (spell_ob->stats.exp) @@ -1240,7 +1240,7 @@ force->duration = spell_ob->duration + SP_level_duration_adjust (caster, spell_ob) * 50; force->speed = 1.0; force->speed_left = -1.0; - SET_FLAG (force, FLAG_APPLIED); + force->set_flag (FLAG_APPLIED); if (!god) { @@ -1304,7 +1304,7 @@ * so that it would still be more affordable to haul * the stuff back to town. */ - if (QUERY_FLAG (obj, FLAG_UNPAID)) + if (obj->flag [FLAG_UNPAID]) value = 0; else if (obj->type == MONEY || obj->type == GEM) value /= 3; @@ -1368,8 +1368,8 @@ { next = tmp->above; - if (tmp->weight > 0 && !QUERY_FLAG (tmp, FLAG_NO_PICK) && - !QUERY_FLAG (tmp, FLAG_ALIVE) && !QUERY_FLAG (tmp, FLAG_IS_CAULDRON)) + if (tmp->weight > 0 && !tmp->flag [FLAG_NO_PICK] && + !tmp->flag [FLAG_ALIVE] && !tmp->flag [FLAG_IS_CAULDRON]) { if (tmp->inv) { @@ -1378,8 +1378,8 @@ for (tmp1 = tmp->inv; tmp1; tmp1 = next1) { next1 = tmp1->below; - if (tmp1->weight > 0 && !QUERY_FLAG (tmp1, FLAG_NO_PICK) && - !QUERY_FLAG (tmp1, FLAG_ALIVE) && !QUERY_FLAG (tmp1, FLAG_IS_CAULDRON)) + if (tmp1->weight > 0 && !tmp1->flag [FLAG_NO_PICK] && + !tmp1->flag [FLAG_ALIVE] && !tmp1->flag [FLAG_IS_CAULDRON]) alchemy_object (tmp1, value, weight); } } @@ -1423,20 +1423,20 @@ int success = 0, was_one = 0; for (object *tmp = op->inv; tmp; tmp = tmp->below) - if (QUERY_FLAG (tmp, FLAG_APPLIED) && - ((QUERY_FLAG (tmp, FLAG_CURSED) && QUERY_FLAG (spell, FLAG_CURSED)) || - (QUERY_FLAG (tmp, FLAG_DAMNED) && QUERY_FLAG (spell, FLAG_DAMNED)))) + if (tmp->flag [FLAG_APPLIED] && + ((tmp->flag [FLAG_CURSED] && spell->flag [FLAG_CURSED]) || + (tmp->flag [FLAG_DAMNED] && spell->flag [FLAG_DAMNED]))) { was_one++; if (tmp->level <= casting_level (caster, spell)) { success++; - if (QUERY_FLAG (spell, FLAG_DAMNED)) - CLEAR_FLAG (tmp, FLAG_DAMNED); + if (spell->flag [FLAG_DAMNED]) + tmp->clr_flag (FLAG_DAMNED); - CLEAR_FLAG (tmp, FLAG_CURSED); - CLEAR_FLAG (tmp, FLAG_KNOWN_CURSED); + tmp->clr_flag (FLAG_CURSED); + tmp->clr_flag (FLAG_KNOWN_CURSED); tmp->value = 0; /* Still can't sell it */ if (object *pl = tmp->visible_to ()) @@ -1471,7 +1471,7 @@ for (tmp = op->inv; tmp; tmp = tmp->below) { - if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) + if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) { identify (tmp); @@ -1495,7 +1495,7 @@ if (num_ident) { for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) - if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) + if (!tmp->flag [FLAG_IDENTIFIED] && !tmp->invisible && need_identify (tmp)) { identify (tmp); @@ -1569,10 +1569,10 @@ for (tmp = last; tmp; tmp = tmp->below) { /* show invisible */ - if (QUERY_FLAG (spell, FLAG_MAKE_INVIS) + if (spell->flag [FLAG_MAKE_INVIS] /* Might there be other objects that we can make visible? */ - && (tmp->invisible && (QUERY_FLAG (tmp, FLAG_MONSTER) - || (tmp->type == PLAYER && !QUERY_FLAG (tmp, FLAG_WIZ)) + && (tmp->invisible && (tmp->flag [FLAG_MONSTER] + || (tmp->type == PLAYER && !tmp->flag [FLAG_WIZ]) || tmp->type == T_HANDLE || tmp->type == TRAPDOOR || tmp->type == EXIT @@ -1598,7 +1598,7 @@ } } - if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) + if (tmp->flag [FLAG_IS_FLOOR]) floor = 1; /* All detections below this point don't descend beneath the floor, @@ -1617,10 +1617,10 @@ */ /* detect magic */ - if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && - !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL) && !QUERY_FLAG (tmp, FLAG_IDENTIFIED) && is_magical (tmp)) + if (spell->flag [FLAG_KNOWN_MAGICAL] && + !tmp->flag [FLAG_KNOWN_MAGICAL] && !tmp->flag [FLAG_IDENTIFIED] && is_magical (tmp)) { - SET_FLAG (tmp, FLAG_KNOWN_MAGICAL); + tmp->set_flag (FLAG_KNOWN_MAGICAL); /* make runes more visible */ if (tmp->type == RUNE && tmp->attacktype & AT_MAGIC) tmp->stats.Cha /= 4; @@ -1629,7 +1629,7 @@ } /* detect monster */ - if (QUERY_FLAG (spell, FLAG_MONSTER) && (QUERY_FLAG (tmp, FLAG_MONSTER) || tmp->type == PLAYER)) + if (spell->flag [FLAG_MONSTER] && (tmp->flag [FLAG_MONSTER] || tmp->type == PLAYER)) { done_one = 2; @@ -1641,7 +1641,7 @@ * match that. if the spell race is set to GOD, then the gods opposing * race must match. */ - if (spell->race && QUERY_FLAG (tmp, FLAG_MONSTER) && tmp->race && + if (spell->race && tmp->flag [FLAG_MONSTER] && tmp->race && ((spell->race == shstr_GOD && god && god->slaying.contains (tmp->race)) || spell->race.contains (tmp->race))) { @@ -1651,10 +1651,10 @@ detect = tmp; } - if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && - (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))) + if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && + (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) { - SET_FLAG (tmp, FLAG_KNOWN_CURSED); + tmp->set_flag (FLAG_KNOWN_CURSED); done_one = 1; } @@ -1690,8 +1690,8 @@ detect_ob->anim_speed = detect->anim_speed; detect_ob->last_anim = 0; /* by default, the detect_ob is already animated */ - if (!QUERY_FLAG (detect, FLAG_ANIMATE)) - CLEAR_FLAG (detect_ob, FLAG_ANIMATE); + if (!detect->flag [FLAG_ANIMATE]) + detect_ob->clr_flag (FLAG_ANIMATE); } m->insert (detect_ob, nx, ny, op, INS_ON_TOP); @@ -1700,26 +1700,26 @@ /* Now process objects in the players inventory if detect curse or magic */ - if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) || QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL)) + if (spell->flag [FLAG_KNOWN_CURSED] || spell->flag [FLAG_KNOWN_MAGICAL]) { done_one = 0; for (tmp = op->inv; tmp; tmp = tmp->below) { - if (!tmp->invisible && !QUERY_FLAG (tmp, FLAG_IDENTIFIED)) + if (!tmp->invisible && !tmp->flag [FLAG_IDENTIFIED]) { - if (QUERY_FLAG (spell, FLAG_KNOWN_MAGICAL) && is_magical (tmp) && !QUERY_FLAG (tmp, FLAG_KNOWN_MAGICAL)) + if (spell->flag [FLAG_KNOWN_MAGICAL] && is_magical (tmp) && !tmp->flag [FLAG_KNOWN_MAGICAL]) { - SET_FLAG (tmp, FLAG_KNOWN_MAGICAL); + tmp->set_flag (FLAG_KNOWN_MAGICAL); if (object *pl = tmp->visible_to ()) esrv_update_item (UPD_FLAGS, pl, tmp); } - if (QUERY_FLAG (spell, FLAG_KNOWN_CURSED) && !QUERY_FLAG (tmp, FLAG_KNOWN_CURSED) && - (QUERY_FLAG (tmp, FLAG_CURSED) || QUERY_FLAG (tmp, FLAG_DAMNED))) + if (spell->flag [FLAG_KNOWN_CURSED] && !tmp->flag [FLAG_KNOWN_CURSED] && + (tmp->flag [FLAG_CURSED] || tmp->flag [FLAG_DAMNED])) { - SET_FLAG (tmp, FLAG_KNOWN_CURSED); + tmp->set_flag (FLAG_KNOWN_CURSED); if (object *pl = tmp->visible_to ()) esrv_update_item (UPD_FLAGS, pl, tmp); @@ -1789,7 +1789,7 @@ if (!(mflags & P_OUT_OF_MAP) && mflags & P_IS_ALIVE) { for (plyr = GET_MAP_OB (m, x, y); plyr != NULL; plyr = plyr->above) - if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) + if (plyr != op && plyr->flag [FLAG_ALIVE]) break; } @@ -1799,7 +1799,7 @@ */ if (plyr == NULL) for (plyr = GET_MAP_OB (op->map, op->x, op->y); plyr != NULL; plyr = plyr->above) - if (plyr != op && QUERY_FLAG (plyr, FLAG_ALIVE)) + if (plyr != op && plyr->flag [FLAG_ALIVE]) break; if (!plyr) @@ -1826,7 +1826,7 @@ sucked = (plyr->stats.sp * rate) / 100; plyr->stats.sp -= sucked; - if (QUERY_FLAG (op, FLAG_ALIVE)) + if (op->flag [FLAG_ALIVE]) { /* Player doesn't get full credit */ sucked = (sucked * rate) / 100; @@ -1887,7 +1887,7 @@ if (head->attacktype & AT_MAGIC && !(head->attacktype & AT_COUNTERSPELL) - && !QUERY_FLAG (head, FLAG_MONSTER) + && !head->flag [FLAG_MONSTER] && (op->level > head->level)) head->destroy (); else @@ -1896,7 +1896,7 @@ case SPELL_EFFECT: // XXX: Don't affect floor spelleffects. See also XXX comment // about sanctuary in spell_util.C - if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) + if (tmp->flag [FLAG_IS_FLOOR]) continue; if (op->level > head->level) @@ -1935,7 +1935,7 @@ for (tmp = op->below; tmp; tmp = tmp->below) { - if (QUERY_FLAG (tmp, FLAG_IS_FLOOR)) + if (tmp->flag [FLAG_IS_FLOOR]) break; if (tmp->type == HOLY_ALTAR) { @@ -2038,7 +2038,7 @@ return 0; } - if (QUERY_FLAG (weapon, FLAG_APPLIED)) + if (weapon->flag [FLAG_APPLIED]) { new_draw_info_format (NDI_BLACK, 0, op, "You need to unequip %s before using it in this spell", query_name (weapon)); return 0; @@ -2050,7 +2050,7 @@ tmp = spell->other_arch->instance (); /* if animated by a player, give the player control of the golem */ - CLEAR_FLAG (tmp, FLAG_MONSTER); + tmp->clr_flag (FLAG_MONSTER); tmp->stats.exp = 0; add_friendly_object (tmp); tmp->type = GOLEM; @@ -2062,7 +2062,7 @@ * removed flag - it should only be set if weapon->split was * used above. */ - if (!QUERY_FLAG (weapon, FLAG_REMOVED)) + if (!weapon->flag [FLAG_REMOVED]) weapon->remove (); tmp->insert (weapon); @@ -2071,8 +2071,8 @@ * so instead, just set it as equipped (otherwise, we need to update * body_info, skills, etc) */ - SET_FLAG (tmp, FLAG_USE_WEAPON); - SET_FLAG (weapon, FLAG_APPLIED); + tmp->set_flag (FLAG_USE_WEAPON); + weapon->set_flag (FLAG_APPLIED); tmp->update_stats (); /* There used to be 'odd' code that basically seemed to take the absolute @@ -2286,10 +2286,10 @@ int atk_lev, def_lev; object *victim = tmp->head_ (); - if (!QUERY_FLAG (victim, FLAG_MONSTER)) + if (!victim->flag [FLAG_MONSTER]) continue; - if (QUERY_FLAG (victim, FLAG_UNAGGRESSIVE)) + if (victim->flag [FLAG_UNAGGRESSIVE]) continue; if (victim->stats.exp == 0) @@ -2315,10 +2315,10 @@ victim->stats.Pow = 0; #endif victim->attack_movement = RANDO2; - SET_FLAG (victim, FLAG_UNAGGRESSIVE); - SET_FLAG (victim, FLAG_RUN_AWAY); - SET_FLAG (victim, FLAG_RANDOM_MOVE); - CLEAR_FLAG (victim, FLAG_MONSTER); + victim->set_flag (FLAG_UNAGGRESSIVE); + victim->set_flag (FLAG_RUN_AWAY); + victim->set_flag (FLAG_RANDOM_MOVE); + victim->clr_flag (FLAG_MONSTER); if (victim->name) new_draw_info_format (NDI_UNIQUE, 0, op->owner, "%s no longer feels like fighting.", &victim->name);