From: Laszlo T. <ave...@us...> - 2012-09-09 07:44:54
|
gemrb: Infinity Engine emulator The branch master has been updated via 0cf746cac66938a757c091f587da5358f8be2530 (commit) Summary of changes: gemrb/core/Effect.h | 4 + gemrb/core/Scriptable/Actor.cpp | 127 +++++++++++++++---------------- gemrb/core/Scriptable/Actor.h | 2 +- gemrb/plugins/FXOpcodes/FXOpcodes.cpp | 2 +- gemrb/plugins/IWDOpcodes/IWDOpcodes.cpp | 30 ++++---- gemrb/plugins/PSTOpcodes/PSTOpcodes.cpp | 2 +- 6 files changed, 83 insertions(+), 84 deletions(-) from 7d87835934e4099b1c3c23d9efcc20167a3ef3c2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=0cf746cac66938a757c091f587da5358f8be2530 commit 0cf746cac66938a757c091f587da5358f8be2530 Author: Avenger <ave...@so...> Date: Sun Sep 9 09:44:00 2012 +0200 implemented ToBEx flags (for effect damage): bypass mirror image, ignore difficulty diff --git a/gemrb/core/Effect.h b/gemrb/core/Effect.h index ae8b8dc..0d46193 100644 --- a/gemrb/core/Effect.h +++ b/gemrb/core/Effect.h @@ -73,6 +73,10 @@ class Actor; #define FX_NO_RESIST_CAN_DISPEL 3 #define FX_CAN_DISPEL 1 +// Effect save flags (ToBEx) +#define SF_BYPASS_MIRROR_IMAGE 0x1000000 +#define SF_IGNORE_DIFFICULTY 0x2000000 + /** * @class Effect * Structure holding information about single spell or spell-like effect. diff --git a/gemrb/core/Scriptable/Actor.cpp b/gemrb/core/Scriptable/Actor.cpp index 4e3ecdc..cafab59 100644 --- a/gemrb/core/Scriptable/Actor.cpp +++ b/gemrb/core/Scriptable/Actor.cpp @@ -316,6 +316,44 @@ std::vector<std::vector<int> > skillrac; static int ReverseToHit=true; static int CheckAbilities=false; +static EffectRef fx_sleep_ref = { "State:Helpless", -1 }; +static EffectRef fx_cleave_ref = { "Cleave", -1 }; +static EffectRef fx_tohit_vs_creature_ref = { "ToHitVsCreature", -1 }; +static EffectRef fx_damage_vs_creature_ref = { "DamageVsCreature", -1 }; +static EffectRef fx_mirrorimage_ref = { "MirrorImageModifier", -1 }; +static EffectRef fx_set_charmed_state_ref = { "State:Charmed", -1 }; +static EffectRef fx_cure_sleep_ref = { "Cure:Sleep", -1 }; +//bg2 and iwd1 +static EffectRef control_creature_ref = { "ControlCreature", -1 }; +//iwd2 +static EffectRef control_undead_ref = { "ControlUndead2", -1 }; +static EffectRef fx_cure_poisoned_state_ref = { "Cure:Poison", -1 }; +static EffectRef fx_cure_hold_state_ref = { "Cure:Hold", -1 }; +static EffectRef fx_cure_stun_state_ref = { "Cure:Stun", -1 }; +static EffectRef fx_remove_portrait_icon_ref = { "Icon:Remove", -1 }; +static EffectRef fx_unpause_caster_ref = { "Cure:CasterHold", -1 }; +static EffectRef fx_ac_vs_creature_type_ref = { "ACVsCreatureType", -1 }; +static EffectRef fx_puppetmarker_ref = { "PuppetMarker", -1 }; +static EffectRef fx_stoneskin_ref = { "StoneSkinModifier", -1 }; +static EffectRef fx_stoneskin2_ref = { "StoneSkin2Modifier", -1 }; +static EffectRef fx_aegis_ref = { "Aegis", -1 }; +static EffectRef fx_cloak_ref = { "Overlay", -1 }; +static EffectRef fx_damage_ref = { "Damage", -1 }; +static EffectRef fx_melee_ref = { "SetMeleeEffect", -1 }; +static EffectRef fx_ranged_ref = { "SetRangedEffect", -1 }; +static EffectRef fx_cant_use_item_ref = { "CantUseItem", -1 }; +static EffectRef fx_cant_use_item_type_ref = { "CantUseItemType", -1 }; +static EffectRef fx_remove_invisible_state_ref = { "ForceVisible", -1 }; +static EffectRef fx_remove_sanctuary_ref = { "Cure:Sanctuary", -1 }; +static EffectRef fx_disable_button_ref = { "DisableButton", -1 }; + +//used by iwd2 +static ieResRef resref_cripstr={"cripstr"}; +static ieResRef resref_dirty={"dirty"}; + +static const int weapon_damagetype[] = {DAMAGE_CRUSHING, DAMAGE_PIERCING, + DAMAGE_CRUSHING, DAMAGE_SLASHING, DAMAGE_MISSILE, DAMAGE_STUNNING}; + //internal flags for calculating to hit #define WEAPON_FIST 0 #define WEAPON_MELEE 1 @@ -2587,7 +2625,6 @@ void Actor::CheckPuppet(Actor *puppet, ieDword type) Modified[IE_PUPPETID] = puppet->GetGlobalID(); } -static EffectRef fx_set_charmed_state_ref = { "State:Charmed", -1 }; /** call this after load, to apply effects */ void Actor::RefreshEffects(EffectQueue *fx) @@ -3416,8 +3453,6 @@ void Actor::DialogInterrupt() } } -static EffectRef fx_cure_sleep_ref = { "Cure:Sleep", -1 }; - void Actor::GetHit() { if (!Immobile()) { @@ -3472,9 +3507,6 @@ bool Actor::CheckSilenced() return true; } -static EffectRef fx_sleep_ref = { "State:Helpless", -1 }; -static EffectRef fx_cleave_ref = { "Cleave", -1 }; - void Actor::CheckCleave() { int cleave = GetFeat(FEAT_CLEAVE); @@ -3492,11 +3524,9 @@ void Actor::CheckCleave() } } -static EffectRef fx_tohit_vs_creature_ref = { "ToHitVsCreature", -1 }; -static EffectRef fx_damage_vs_creature_ref = { "DamageVsCreature", -1 }; //returns actual damage -int Actor::Damage(int damage, int damagetype, Scriptable *hitter, int modtype, int critical) +int Actor::Damage(int damage, int damagetype, Scriptable *hitter, int modtype, int critical, int saveflags) { //won't get any more hurt if (InternalFlags & IF_REALLYDIED) { @@ -3540,8 +3570,29 @@ int Actor::Damage(int damage, int damagetype, Scriptable *hitter, int modtype, i int resisted = 0; - ModifyDamage (hitter, damage, resisted, damagetype); + if (!(saveflags&SF_BYPASS_MIRROR_IMAGE)) { + int mirrorimages = Modified[IE_MIRRORIMAGES]; + if (mirrorimages) { + if (LuckyRoll(1,mirrorimages+1,0) != 1) { + fxqueue.DecreaseParam1OfEffect(fx_mirrorimage_ref, 1); + Modified[IE_MIRRORIMAGES]--; + damage = 0; + } + } + } + + if (!(saveflags&SF_IGNORE_DIFFICULTY)) { + // adjust enemy damage according to difficulty settings: + // -50%, -25%, 0, 50%, 100%, 150% + if (Modified[IE_EA] < EA_GOODCUTOFF) { + int adjustmentPercent = dmgadjustments[GameDifficulty]; + damage += (damage * adjustmentPercent)/100; + } + } + if (damage) { + ModifyDamage (hitter, damage, resisted, damagetype); + } DisplayCombatFeedback(damage, resisted, damagetype, hitter); // instant chunky death if the actor is petrified or frozen @@ -4116,11 +4167,6 @@ int Actor::CalculateSpeed(bool feedback) return 0; } -//bg2 and iwd1 -static EffectRef control_creature_ref = { "ControlCreature", -1 }; -//iwd2 -static EffectRef control_undead_ref = { "ControlUndead2", -1 }; - //receive turning void Actor::Turn(Scriptable *cleric, ieDword turnlevel) { @@ -4220,12 +4266,6 @@ void Actor::Resurrect() //clear effects? } -static EffectRef fx_cure_poisoned_state_ref = { "Cure:Poison", -1 }; -static EffectRef fx_cure_hold_state_ref = { "Cure:Hold", -1 }; -static EffectRef fx_cure_stun_state_ref = { "Cure:Stun", -1 }; -static EffectRef fx_remove_portrait_icon_ref = { "Icon:Remove", -1 }; -static EffectRef fx_unpause_caster_ref = { "Cure:CasterHold", -1 }; - const char *GetVarName(const char *table, int value) { int symbol = core->LoadSymbol( table ); @@ -5563,10 +5603,6 @@ int Actor::GetToHit(int bonus, ieDword Flags, Actor *target) const return tohit; } -static const int weapon_damagetype[] = {DAMAGE_CRUSHING, DAMAGE_PIERCING, - DAMAGE_CRUSHING, DAMAGE_SLASHING, DAMAGE_MISSILE, DAMAGE_STUNNING}; -static EffectRef fx_ac_vs_creature_type_ref = { "ACVsCreatureType", -1 }; - int Actor::GetDefense(int DamageType, ieDword wflags, Actor *attacker) const { //specific damage type bonus. @@ -5632,8 +5668,6 @@ int Actor::GetDefense(int DamageType, ieDword wflags, Actor *attacker) const return defense; } -static EffectRef fx_puppetmarker_ref = { "PuppetMarker", -1 }; - void Actor::PerformAttack(ieDword gameTime) { if (InParty) { @@ -5878,12 +5912,6 @@ void Actor::PerformAttack(ieDword gameTime) ResetState(); } -static EffectRef fx_stoneskin_ref = { "StoneSkinModifier", -1 }; -static EffectRef fx_stoneskin2_ref = { "StoneSkin2Modifier", -1 }; -static EffectRef fx_mirrorimage_ref = { "MirrorImageModifier", -1 }; -static EffectRef fx_aegis_ref = { "Aegis", -1 }; -static EffectRef fx_cloak_ref = { "Overlay", -1 }; - int Actor::WeaponDamageBonus(const WeaponInfo &wi) const { if (wi.wflags&WEAPON_USESTRENGTH) { @@ -5899,9 +5927,6 @@ int Actor::WeaponDamageBonus(const WeaponInfo &wi) const return 0; } -static ieResRef resref_cripstr={"cripstr"}; -static ieResRef resref_dirty={"dirty"}; - /*Always call this on the suffering actor */ void Actor::ModifyDamage(Scriptable *hitter, int &damage, int &resisted, int damagetype) { @@ -5911,16 +5936,6 @@ void Actor::ModifyDamage(Scriptable *hitter, int &damage, int &resisted, int dam attacker = (Actor *) hitter; } - int mirrorimages = Modified[IE_MIRRORIMAGES]; - if (mirrorimages) { - if (LuckyRoll(1,mirrorimages+1,0) != 1) { - fxqueue.DecreaseParam1OfEffect(fx_mirrorimage_ref, 1); - Modified[IE_MIRRORIMAGES]--; - damage = 0; - return; - } - } - //guardian mantle for PST if (attacker && (Modified[IE_IMMUNITY]&IMM_GUARDIAN) ) { //if the hitter doesn't make the spell save, the mantle works and the damage is 0 @@ -5959,13 +5974,6 @@ void Actor::ModifyDamage(Scriptable *hitter, int &damage, int &resisted, int dam } if (damage>0) { - // adjust enemy damage according to difficulty settings: - // -50%, -25%, 0, 50%, 100%, 150% - if (Modified[IE_EA] < EA_GOODCUTOFF) { - int adjustmentPercent = dmgadjustments[GameDifficulty]; - damage += (damage * adjustmentPercent)/100; - } - // check damage type immunity / resistance / susceptibility std::multimap<ieDword, DamageInfoStruct>::iterator it; it = core->DamageInfoMap.find(damagetype); @@ -7279,10 +7287,6 @@ bool Actor::UseItemPoint(ieDword slot, ieDword header, const Point &target, ieDw return false; } -static EffectRef fx_damage_ref = { "Damage", -1 }; -static EffectRef fx_melee_ref = { "SetMeleeEffect", -1 }; -static EffectRef fx_ranged_ref = { "SetRangedEffect", -1 }; - void Actor::ModifyWeaponDamage(WeaponInfo &wi, Actor *target, int &damage, bool &critical) { //Calculate weapon based damage bonuses (strength bonus, dexterity bonus, backstab) @@ -7693,9 +7697,6 @@ int Actor::CheckUsability(Item *item) const return 0; } -static EffectRef fx_cant_use_item_ref = { "CantUseItem", -1 }; -static EffectRef fx_cant_use_item_type_ref = { "CantUseItemType", -1 }; - //this one is the same, but returns strrefs based on effects ieStrRef Actor::Disabled(ieResRef name, ieDword type) const { @@ -8274,8 +8275,6 @@ int Actor::LuckyRoll(int dice, int size, int add, ieDword flags, Actor* opponent } } -static EffectRef fx_remove_invisible_state_ref = { "ForceVisible", -1 }; - // removes the (normal) invisibility state void Actor::CureInvisibility() { @@ -8294,8 +8293,6 @@ void Actor::CureInvisibility() } } -static EffectRef fx_remove_sanctuary_ref = { "Cure:Sanctuary", -1 }; - // removes the sanctuary effect void Actor::CureSanctuary() { @@ -8374,8 +8371,6 @@ bool Actor::ModalSpellSkillCheck() { } } -static EffectRef fx_disable_button_ref = { "DisableButton", -1 }; - inline void HideFailed(Actor* actor) { Effect *newfx; diff --git a/gemrb/core/Scriptable/Actor.h b/gemrb/core/Scriptable/Actor.h index b733bcc..c7313df 100644 --- a/gemrb/core/Scriptable/Actor.h +++ b/gemrb/core/Scriptable/Actor.h @@ -534,7 +534,7 @@ public: /* check and perform a cleave movement */ void CheckCleave(); /* deals damage to this actor */ - int Damage(int damage, int damagetype, Scriptable *hitter, int modtype=MOD_ADDITIVE, int critical=0); + int Damage(int damage, int damagetype, Scriptable *hitter, int modtype=MOD_ADDITIVE, int critical=0, int saveflags=0); /* displays the damage taken and other details (depends on the game type) */ void DisplayCombatFeedback (unsigned int damage, int resisted, int damagetype, Scriptable *hitter); /* play a random footstep sound */ diff --git a/gemrb/plugins/FXOpcodes/FXOpcodes.cpp b/gemrb/plugins/FXOpcodes/FXOpcodes.cpp index 95e9af0..b4640e2 100644 --- a/gemrb/plugins/FXOpcodes/FXOpcodes.cpp +++ b/gemrb/plugins/FXOpcodes/FXOpcodes.cpp @@ -1329,7 +1329,7 @@ int fx_damage (Scriptable* /*Owner*/, Actor* target, Effect* fx) } } - target->Damage(fx->Parameter1, damagetype, caster, modtype, fx->IsVariable); + target->Damage(fx->Parameter1, damagetype, caster, modtype, fx->IsVariable, fx->SavingThrowType); //this effect doesn't stick return FX_NOT_APPLIED; } diff --git a/gemrb/plugins/IWDOpcodes/IWDOpcodes.cpp b/gemrb/plugins/IWDOpcodes/IWDOpcodes.cpp index a5bdaac..1f0acaf 100644 --- a/gemrb/plugins/IWDOpcodes/IWDOpcodes.cpp +++ b/gemrb/plugins/IWDOpcodes/IWDOpcodes.cpp @@ -789,7 +789,7 @@ int fx_iwd_visual_spell_hit (Scriptable* Owner, Actor* target, Effect* fx) int fx_cold_damage (Scriptable* Owner, Actor* target, Effect* fx) { if(0) print("fx_cold_damage(%2d): Damage %d", fx->Opcode, fx->Parameter1); - target->Damage(fx->Parameter1, DAMAGE_COLD, Owner); + target->Damage(fx->Parameter1, DAMAGE_COLD, Owner, fx->IsVariable, fx->SavingThrowType); return FX_NOT_APPLIED; } @@ -801,7 +801,7 @@ int fx_cold_damage (Scriptable* Owner, Actor* target, Effect* fx) int fx_chill_touch (Scriptable* Owner, Actor* target, Effect* fx) { if(0) print("fx_chill_touch(%2d)", fx->Opcode); - target->Damage(fx->Parameter1, DAMAGE_COLD, Owner); + target->Damage(fx->Parameter1, DAMAGE_COLD, Owner, fx->IsVariable, fx->SavingThrowType); if (STAT_GET(IE_GENERAL)==GEN_UNDEAD) { target->Panic(Owner, PANIC_RUNAWAY); } @@ -836,7 +836,7 @@ int fx_chill_touch_panic (Scriptable* /*Owner*/, Actor* target, Effect* fx) int fx_crushing_damage (Scriptable* Owner, Actor* target, Effect* fx) { if(0) print("fx_crushing_damage(%2d): Damage %d", fx->Opcode, fx->Parameter1); - target->Damage(fx->Parameter1, DAMAGE_CRUSHING, Owner); + target->Damage(fx->Parameter1, DAMAGE_CRUSHING, Owner, fx->IsVariable, fx->SavingThrowType); return FX_NOT_APPLIED; } @@ -945,7 +945,7 @@ int fx_vampiric_touch (Scriptable* Owner, Actor* target, Effect* fx) default: return FX_NOT_APPLIED; } - int damage = donor->Damage(fx->Parameter1, fx->Parameter2, owner); + int damage = donor->Damage(fx->Parameter1, fx->Parameter2, owner, fx->IsVariable, fx->SavingThrowType); receiver->SetBase( IE_HITPOINTS, BASE_GET( IE_HITPOINTS ) + ( damage ) ); return FX_NOT_APPLIED; } @@ -1070,7 +1070,7 @@ int fx_burning_blood (Scriptable* Owner, Actor* target, Effect* fx) damage = DAMAGE_COLD; } - target->Damage(fx->Parameter1, damage, Owner); + target->Damage(fx->Parameter1, damage, Owner, fx->IsVariable, fx->SavingThrowType); STAT_SET(IE_CHECKFORBERSERK,1); return FX_NOT_APPLIED; } @@ -1101,7 +1101,7 @@ int fx_burning_blood2 (Scriptable* Owner, Actor* target, Effect* fx) } //this effect doesn't use Parameter1 to modify damage, it is a counter instead - target->Damage(DICE_ROLL(0), damage, Owner); + target->Damage(DICE_ROLL(0), damage, Owner, fx->IsVariable, fx->SavingThrowType); STAT_SET(IE_CHECKFORBERSERK,1); return FX_APPLIED; } @@ -1183,7 +1183,7 @@ int fx_lich_touch (Scriptable* Owner, Actor* target, Effect* fx) if (STAT_GET(IE_GENERAL)==GEN_UNDEAD) { return FX_NOT_APPLIED; } - target->Damage(DICE_ROLL(0), DAMAGE_COLD, Owner); + target->Damage(DICE_ROLL(0), DAMAGE_COLD, Owner, fx->IsVariable, fx->SavingThrowType ); ///convert to hold creature ///shall we check for immunity vs. #175? ///if yes, then probably it is easier to apply the hold effect instead of converting to it @@ -1208,10 +1208,10 @@ int fx_blinding_orb (Scriptable* Owner, Actor* target, Effect* fx) //check saving throw bool st = target->GetSavingThrow(0,0); //spell if (st) { - target->Damage(damage/2, DAMAGE_FIRE, Owner); + target->Damage(damage/2, DAMAGE_FIRE, Owner, fx->IsVariable, fx->SavingThrowType); return FX_NOT_APPLIED; } - target->Damage(damage, DAMAGE_FIRE, Owner); + target->Damage(damage, DAMAGE_FIRE, Owner, fx->IsVariable, fx->SavingThrowType); //convert effect to a blind effect. fx->Opcode = EffectQueue::ResolveEffect(fx_state_blind_ref); @@ -1591,7 +1591,7 @@ int fx_static_charge(Scriptable* Owner, Actor* target, Effect* fx) } //how style - target->Damage(DICE_ROLL(0), DAMAGE_ELECTRICITY, Owner); + target->Damage(DICE_ROLL(0), DAMAGE_ELECTRICITY, Owner, fx->IsVariable, fx->SavingThrowType); return ret; } @@ -1776,7 +1776,7 @@ int fx_soul_eater (Scriptable* Owner, Actor* target, Effect* fx) damage = core->Roll(3, 8, 0); } - target->Damage(damage, DAMAGE_SOULEATER, Owner); + target->Damage(damage, DAMAGE_SOULEATER, Owner, fx->IsVariable, fx->SavingThrowType); //the state is not set soon enough! //if (STATE_GET(STATE_DEAD) ) { if (target->GetInternalFlag() & IF_REALLYDIED) { @@ -1846,7 +1846,7 @@ int fx_shroud_of_flame (Scriptable* Owner, Actor* target, Effect* fx) damagetype = DAMAGE_COLD; } - target->Damage(fx->Parameter1, damagetype, Owner); + target->Damage(fx->Parameter1, damagetype, Owner, fx->IsVariable, fx->SavingThrowType); ApplyDamageNearby(Owner, target, fx, damagetype); return FX_APPLIED; } @@ -1996,7 +1996,7 @@ int fx_vitriolic_sphere (Scriptable* Owner, Actor* target, Effect* fx) if (core->GetGame()->GameTime%6) { return FX_APPLIED; } - target->Damage(fx->Parameter1, DAMAGE_ACID, Owner); + target->Damage(fx->Parameter1, DAMAGE_ACID, Owner, fx->IsVariable, fx->SavingThrowType); fx->DiceThrown-=2; if ((signed) fx->DiceThrown<1) { return FX_NOT_APPLIED; @@ -2813,7 +2813,7 @@ seconds: break; } //percent - target->Damage(damage, DAMAGE_POISON, Owner); + target->Damage(damage, DAMAGE_POISON, Owner, fx->IsVariable, fx->SavingThrowType); target->AddPortraitIcon(PI_BLEEDING); return FX_APPLIED; } @@ -3520,7 +3520,7 @@ int fx_call_lightning (Scriptable* /*Owner*/, Actor* target, Effect* fx) } //how style - victim->Damage(DICE_ROLL(0), DAMAGE_ELECTRICITY, target); + victim->Damage(DICE_ROLL(0), DAMAGE_ELECTRICITY, target, fx->IsVariable, fx->SavingThrowType); return ret; } diff --git a/gemrb/plugins/PSTOpcodes/PSTOpcodes.cpp b/gemrb/plugins/PSTOpcodes/PSTOpcodes.cpp index 3444568..559800e 100644 --- a/gemrb/plugins/PSTOpcodes/PSTOpcodes.cpp +++ b/gemrb/plugins/PSTOpcodes/PSTOpcodes.cpp @@ -377,7 +377,7 @@ int fx_transfer_hp (Scriptable* Owner, Actor* target, Effect* fx) damage=(signed) fx->Parameter1; } if (damage) { - damage = donor->Damage(damage, fx->Parameter2, owner); + damage = donor->Damage(damage, fx->Parameter2, owner, fx->IsVariable, fx->SavingThrowType); receiver->NewBase( IE_HITPOINTS, damage, MOD_ADDITIVE ); } return FX_NOT_APPLIED; ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |