/// <summary> /// /// </summary> /// <param name="CastInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(CastInfos CastInfos) { if (CastInfos.Target == null) { return(FightActionResultEnum.RESULT_NOTHING); } var malusType = _targetMalus[CastInfos.EffectType]; var bonusType = _casterBonus[CastInfos.EffectType]; var malusInfos = new CastInfos(malusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Target); var bonusInfos = new CastInfos(bonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Target); var damageValue = 0; if (CastInfos.Target == CastInfos.Caster) { return(FightActionResultEnum.RESULT_NOTHING); } // Malus a la cible var BuffStats = new StatsBuff(malusInfos, CastInfos.Target); if (BuffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END) { return(FightActionResultEnum.RESULT_END); } CastInfos.Target.BuffManager.AddBuff(BuffStats); // Bonus au lanceur BuffStats = new StatsBuff(bonusInfos, CastInfos.Caster); CastInfos.Caster.BuffManager.AddBuff(BuffStats); return(BuffStats.ApplyEffect(ref damageValue)); }
/// <summary> /// /// </summary> /// <param name="CastInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(CastInfos CastInfos) { if (CastInfos.Target == null) return FightActionResultEnum.RESULT_NOTHING; var malusType = _targetMalus[CastInfos.EffectType]; var bonusType = _casterBonus[CastInfos.EffectType]; var malusInfos = new CastInfos(malusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration, CastInfos.Caster, CastInfos.Target); var bonusInfos = new CastInfos(bonusType, CastInfos.SpellId, CastInfos.CellId, CastInfos.Value1, CastInfos.Value2, CastInfos.Value3, CastInfos.Chance, CastInfos.Duration - 1, CastInfos.Caster, CastInfos.Target); var damageValue = 0; if (CastInfos.Target == CastInfos.Caster) return FightActionResultEnum.RESULT_NOTHING; // Malus a la cible var BuffStats = new StatsBuff(malusInfos, CastInfos.Target); if (BuffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END) return FightActionResultEnum.RESULT_END; CastInfos.Target.BuffManager.AddBuff(BuffStats); // Bonus au lanceur BuffStats = new StatsBuff(bonusInfos, CastInfos.Caster); CastInfos.Caster.BuffManager.AddBuff(BuffStats); return BuffStats.ApplyEffect(ref damageValue); }
/// <summary> /// /// </summary> /// <param name="damageValue"></param> /// <param name="damageInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null) { var buffValue = damageValue / 2; // Divise par deux les stats a boost car c'est un personnage. var statsType = (EffectEnum)CastInfos.Value1; var maxValue = CastInfos.Value2; var duration = CastInfos.Value3; if (Target.Fight.CurrentFighter.Id == CastInfos.FakeValue) { if (CastInfos.DamageValue < maxValue) { if (CastInfos.DamageValue + buffValue > maxValue) { buffValue = maxValue - CastInfos.DamageValue; } } else { buffValue = 0; } } else { CastInfos.DamageValue = 0; CastInfos.FakeValue = (int)Target.Fight.CurrentFighter.Id; if (CastInfos.DamageValue + buffValue > maxValue) { buffValue = maxValue; } } if (buffValue != 0) { CastInfos.DamageValue += buffValue; switch(statsType) { case EffectEnum.Heal: HealEffect.ApplyHeal(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target, ref buffValue); break; default: var BuffStats = new StatsBuff(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target); BuffStats.ApplyEffect(ref buffValue); Target.BuffManager.AddBuff(BuffStats); break; } } return base.ApplyEffect(ref damageValue, damageInfos); }
/// <summary> /// /// </summary> /// <param name="damageValue"></param> /// <param name="damageInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null) { var buffValue = damageValue / 2; // Divise par deux les stats a boost car c'est un personnage. var statsType = (EffectEnum)CastInfos.Value1; var maxValue = CastInfos.Value2; var duration = CastInfos.Value3; if (Target.Fight.CurrentFighter.Id == CastInfos.FakeValue) { if (CastInfos.DamageValue < maxValue) { if (CastInfos.DamageValue + buffValue > maxValue) { buffValue = maxValue - CastInfos.DamageValue; } } else { buffValue = 0; } } else { CastInfos.DamageValue = 0; CastInfos.FakeValue = (int)Target.Fight.CurrentFighter.Id; if (CastInfos.DamageValue + buffValue > maxValue) { buffValue = maxValue; } } if (buffValue != 0) { CastInfos.DamageValue += buffValue; switch (statsType) { case EffectEnum.Heal: HealEffect.ApplyHeal(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target, ref buffValue); break; default: var BuffStats = new StatsBuff(new CastInfos(statsType, CastInfos.SpellId, CastInfos.SpellId, buffValue, 0, 0, 0, duration, CastInfos.Caster, null), Target); BuffStats.ApplyEffect(ref buffValue); Target.BuffManager.AddBuff(BuffStats); break; } } return(base.ApplyEffect(ref damageValue, damageInfos)); }
/// <summary> /// /// </summary> /// <param name="castInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(CastInfos castInfos) { if (castInfos.Target == null) return FightActionResultEnum.RESULT_NOTHING; var subInfos = new CastInfos(castInfos.EffectType, castInfos.SpellId, castInfos.CellId, castInfos.RandomJet, castInfos.Value2, castInfos.Value3, castInfos.Chance, castInfos.Duration, castInfos.Caster, castInfos.Target); var buffStats = new StatsBuff(subInfos, castInfos.Target); var damageValue = 0; if (buffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END) return FightActionResultEnum.RESULT_END; castInfos.Target.BuffManager.AddBuff(buffStats); return FightActionResultEnum.RESULT_NOTHING; }
/// <summary> /// /// </summary> /// <param name="damageValue"></param> /// <param name="damageInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null) { var apLost = CastInfos.Value1 > Target.AP ? Target.AP : CastInfos.Value1; CastInfos.Value1 = Target.CalculDodgeAPMP(CastInfos.Caster, apLost); if (CastInfos.Value1 != apLost) { Target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_DODGE_SUBPA, Target.Id, Target.Id + "," + (apLost - CastInfos.Value1))); } if (CastInfos.Value1 > 0) { var buffStats = new StatsBuff(new CastInfos(CastInfos.EffectType, CastInfos.SpellId, CastInfos.SpellId, CastInfos.Value1, 0, 0, 0, Duration, CastInfos.Caster, null), Target); buffStats.ApplyEffect(ref apLost); Target.BuffManager.AddBuff(buffStats); } return base.ApplyEffect(ref damageValue, damageInfos); }
/// <summary> /// /// </summary> /// <param name="castInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(CastInfos castInfos) { if (castInfos.Target == null) { return(FightActionResultEnum.RESULT_NOTHING); } var subInfos = new CastInfos(castInfos.EffectType, castInfos.SpellId, castInfos.CellId, castInfos.RandomJet, castInfos.Value2, castInfos.Value3, castInfos.Chance, castInfos.Duration, castInfos.Caster, castInfos.Target); var buffStats = new StatsBuff(subInfos, castInfos.Target); var damageValue = 0; if (buffStats.ApplyEffect(ref damageValue) == FightActionResultEnum.RESULT_END) { return(FightActionResultEnum.RESULT_END); } castInfos.Target.BuffManager.AddBuff(buffStats); return(FightActionResultEnum.RESULT_NOTHING); }
/// <summary> /// /// </summary> /// <param name="damageValue"></param> /// <param name="damageInfos"></param> /// <returns></returns> public override FightActionResultEnum ApplyEffect(ref int damageValue, CastInfos damageInfos = null) { var mpLost = CastInfos.Value1 > Target.MP ? Target.MP : CastInfos.Value1; CastInfos.Value1 = Target.CalculDodgeAPMP(CastInfos.Caster, mpLost, true); if (CastInfos.Value1 != mpLost) { Target.Fight.Dispatch(WorldMessage.GAME_ACTION(GameActionTypeEnum.FIGHT_DODGE_SUBPM, Target.Id, Target.Id + "," + (mpLost - CastInfos.Value1))); } if (CastInfos.Value1 > 0) { var buff = new StatsBuff(new CastInfos(CastInfos.EffectType, CastInfos.SpellId, CastInfos.SpellId, CastInfos.Value1, 0, 0, 0, Duration, CastInfos.Caster, null), Target); buff.ApplyEffect(ref mpLost); Target.BuffManager.AddBuff(buff); } return(base.ApplyEffect(ref damageValue, damageInfos)); }