public void AddBuff(EffectCast buff, BuffActiveType active, BuffDecrementType decrement) { buff = buff.CopyToBuff(); if (buff.Target == buff.Target.Fight.CurrentFighter) buff.Duration += 1; myBuffActives[active].Add(buff); myBuffDecrements[decrement].Add(buff); switch (buff.Type) { case EffectEnum.ChanceEcaflip: buff.Target.Fight.Send("GIE" + (int)buff.Type + ';' + buff.Target.ID + ';' + buff.Value1 + ';' + buff.Value2 + ';' + buff.Value3 + ';' + buff.Chance + ';' + buff.Duration + ';' + buff.SpellID); break; default: buff.Target.Fight.Send("GIE" + (int)buff.Type + ';' + buff.Target.ID + ';' + buff.Value1 + ';' + (buff.Value2 == -1 ? "" : buff.Value2.ToString()) + ";;" + buff.Chance + ';' + buff.Duration + ';' + buff.SpellID); break; } }
public static void EffectPunition(EffectCast cast) { if (cast.Target == null) return; cast.Jet = (int)((double)cast.RandomJet / 100 * Math.Pow(Math.Cos(2 * Math.PI * ((double)cast.Caster.Life / cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total - 0.5)) + 1, 2) / 4 * cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total); if (cast.Jet > cast.Target.Life) cast.Jet = cast.Target.Life; cast.Target.Life -= cast.Jet; cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ",-" + cast.Jet); }
public static void RemoveBuffStats(EffectCast cast, EffectCast actualCast) { cast.Target.Stats.ModifyStatBonus(cast.Type, cast.Jet, true); }
public static void RemoveBuffArmor(EffectCast cast, EffectCast actualCast) { Fighter target = cast.Target; switch (cast.SpellID) { case 1: target.Stats.ModifyStatBonus(EffectEnum.SubArmorFeu, cast.Jet); break; case 6: target.Stats.ModifyStatBonus(EffectEnum.SubArmorTerre, cast.Jet); break; case 14: target.Stats.ModifyStatBonus(EffectEnum.SubArmorAir, cast.Jet); break; case 18: target.Stats.ModifyStatBonus(EffectEnum.SubArmorEau, cast.Jet); break; default: target.Stats.ModifyStatBonus(EffectEnum.SubArmor, cast.Jet); break; } }
public static void ApplyBuffSacrifice(EffectCast cast, EffectCast actualCast) { EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.Transpose, cast.SpellID, -1, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target)); actualCast.Target = cast.Caster; }
public static void ApplyBuffIncreaseSpellDamage(EffectCast cast, EffectCast actualCast) { if (cast.SpellID == actualCast.SpellID) actualCast.Jet += cast.Value3; }
public static void ApplyBuffChatimentDamage(EffectCast cast, EffectCast actualCast) { actualCast.Jet = (int)((1 + (double)cast.Value1 / 100) * actualCast.Jet); }
public static void ApplyBuffChanceEcaflip(EffectCast cast, EffectCast actualCast) { int coefDamages = cast.Value1; int coefHeal = cast.Value2; int chance = cast.Value3; if (Utilities.Basic.Rand(0, 99) < chance) { EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.Heal, cast.SpellID, actualCast.Jet * coefHeal, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target)); actualCast.Jet = 0; } else { actualCast.Jet *= coefDamages; } }
public static void EffectSubMPEsquive(EffectCast cast) { if (cast.Target == null) return; if (cast.Duration == 0) return; cast.Jet = cast.RandomJet; if (cast.Jet > cast.Target.Stats.GetStat(StatEnum.MaxPM).Total) cast.Jet = cast.Target.Stats.GetStat(StatEnum.MaxPM).Total; cast.Jet = cast.Target.CalculDodgeAPMP(cast.Caster, cast.Jet, true); if (cast.Jet < cast.RandomJet) cast.Caster.Fight.Send("GA;309;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + (cast.RandomJet - cast.Jet)); if (cast.Jet > 0) { cast.RandomJet = cast.Jet; EffectStats(cast); } }
public static void EffectStealStats(EffectCast cast) { if (cast.Target == null) return; if (cast.Duration == 0) return; EffectEnum malusEffect = EffectEnum.None; EffectEnum bonusEffect = EffectEnum.None; switch (cast.Type) { case EffectEnum.VolSagesse: malusEffect = EffectEnum.SubSagesse; bonusEffect = EffectEnum.AddSagesse; break; case EffectEnum.VolForce: malusEffect = EffectEnum.SubForce; bonusEffect = EffectEnum.AddForce; break; case EffectEnum.VolIntell: malusEffect = EffectEnum.SubIntelligence; bonusEffect = EffectEnum.AddIntelligence; break; case EffectEnum.VolChance: malusEffect = EffectEnum.SubChance; bonusEffect = EffectEnum.AddChance; break; case EffectEnum.VolAgi: malusEffect = EffectEnum.SubAgilite; bonusEffect = EffectEnum.AddAgilite; break; case EffectEnum.VolPA: malusEffect = EffectEnum.SubPA; bonusEffect = EffectEnum.AddPA; break; case EffectEnum.VolPM: malusEffect = EffectEnum.SubPM; bonusEffect = EffectEnum.AddPM; break; case EffectEnum.VolPO: malusEffect = EffectEnum.SubPO; bonusEffect = EffectEnum.AddPO; break; } if (malusEffect == EffectEnum.None || bonusEffect == EffectEnum.None) return; cast.Type = malusEffect; EffectStats(cast); cast.Type = bonusEffect; cast.Target = cast.Caster; EffectStats(cast); }
public static void EffectStealLifeFix(EffectCast cast) { if (cast.Target == null) return; cast.Jet = cast.RandomJet; if (cast.Jet > cast.Target.Life) cast.Jet = cast.Target.Life; cast.Target.Life -= cast.Jet; cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Target.ID + ",-" + cast.Jet); if (cast.Caster.Life + cast.Jet > cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total) cast.Jet = cast.Caster.Stats.GetStat(StatEnum.MaxLife).Total - cast.Caster.Life; cast.Caster.Life += cast.Jet; cast.Caster.Fight.Send("GA;100;" + cast.Caster.ID + ';' + cast.Caster.ID + ',' + cast.Jet); }
public static void EffectStealLife(EffectCast cast) { if (cast.Target == null) return; EffectDamage(cast); cast.RandomJet /= 2; cast.Target = cast.Caster; EffectHeal(cast); }
public static void EffectStats(EffectCast cast) { if (cast.Target == null) return; if (cast.Duration == 0) return; cast.Jet = cast.RandomJet; cast.Target.Stats.ModifyStatBonus(cast.Type, cast.Jet); bool negative = false; if (cast.Type == EffectEnum.SubPA || cast.Type == EffectEnum.SubPM || cast.Type == EffectEnum.SubPAEsquive || cast.Type == EffectEnum.SubPMEsquive) negative = true; cast.Caster.Fight.Send("GA;" + (int)cast.Type + ';' + cast.Caster.ID + ';' + cast.Target.ID + ',' + (negative ? "-" : string.Empty) + cast.Jet + ',' + cast.Duration); cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_STATS, BuffDecrementType.TYPE_ENDTURN); }
public static void EffectSacrifice(EffectCast cast) { if (cast.Target == null) return; if (cast.Duration == 0) return; cast.Target.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACKED_POST_JET, BuffDecrementType.TYPE_ENDTURN); }
public static void EffectPush(EffectCast cast) { int direction = -1; switch (cast.Type) { case EffectEnum.PushBack: if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.CellID, cast.Target.Cell) && cast.CellID != cast.Target.Cell) direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.CellID, cast.Target.Cell); else if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell)) direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell); else return; break; case EffectEnum.PushFront: if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.Target.Cell)) direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Target.Cell, cast.Caster.Cell); else return; break; case EffectEnum.PushFear: if (Pathfinding.InLine(cast.Caster.Fight.Map, cast.Caster.Cell, cast.CellID)) { direction = Pathfinding.GetDirection(cast.Caster.Fight.Map, cast.Caster.Cell, cast.CellID); cast.Target = cast.Caster.Fight.GetAliveFighter(Pathfinding.NextCell(cast.Caster.Fight.Map, cast.Caster.Cell, direction)); } else { return; } break; } if (cast.Target == null) return; int lastCell = cast.Target.Cell; int length = cast.Type != EffectEnum.PushFear ? cast.RandomJet : Pathfinding.GetDistanceBetween(cast.Caster.Fight.Map, cast.Target.Cell, cast.CellID); for (int i = 0; i < length; i++) { int nextCell = Pathfinding.NextCell(cast.Caster.Fight.Map, lastCell, direction); if (cast.Caster.Fight.Map.IsRushableCell(nextCell)) { if (!cast.Caster.Fight.IsFreeCell(nextCell)) { if (i > 0) { cast.Target.Cell = lastCell; cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell); } if (cast.Type == EffectEnum.PushBack) PushBackDamages(cast, length, i); return; } } else { if (i > 0) { cast.Target.Cell = lastCell; cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell); } if (cast.Type == EffectEnum.PushBack) PushBackDamages(cast, length, i); return; } lastCell = nextCell; } cast.Target.Cell = lastCell; cast.Caster.Fight.Send("GA0;5;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + lastCell); }
public void OnAttackAfterJet(EffectCast cast) { foreach (EffectCast buff in myBuffActives[BuffActiveType.ACTIVE_ATTACK_AFTER_JET]) BuffProcessor.ApplyBuff(buff, cast); }
public static void ApplyBuff(EffectCast cast, EffectCast actualCast = null) { if (!RegisteredBuffs.ContainsKey(cast.Type)) return; if (cast.Target == null) return; if (RegisteredBuffs[cast.Type][0] != null) RegisteredBuffs[cast.Type][0](cast, actualCast); }
public static void EffectTeleport(EffectCast cast) { if (!cast.Caster.Fight.Map.IsRushableCell(cast.CellID)) return; cast.Caster.Cell = cast.CellID; cast.Caster.Fight.Send("GA0;4;" + cast.Caster.ID + ';' + cast.Caster.ID + ',' + cast.CellID); }
public static void ApplyBuffChatiment(EffectCast cast, EffectCast actualCast) { int statsValue = actualCast.Jet / 2; EffectEnum statsType = (EffectEnum)cast.Value1 == EffectEnum.Heal ? EffectEnum.AddVitalite : (EffectEnum)cast.Value1; int maxValue = cast.Value2; int duration = cast.Value3; if (statsValue > maxValue) statsValue = maxValue; EffectProcessor.ApplyEffect(new EffectCast(statsType, cast.SpellID, 0, statsValue, -1, -1, 0, duration, false, cast.Caster, null, cast.Target)); }
public static void EffectTranspose(EffectCast cast) { if (cast.Target == null) return; int casterCell = cast.Caster.Cell; EffectTeleport(new EffectCast(EffectEnum.Teleport, cast.SpellID, casterCell, -1, -1, -1, 0, 0, false, cast.Caster, null)); EffectTeleport(new EffectCast(EffectEnum.Teleport, cast.SpellID, casterCell, -1, -1, -1, 0, 0, false, cast.Target, null)); }
public static void ApplyBuffDamage(EffectCast cast, EffectCast actualCast) { EffectProcessor.ApplyEffect(cast); }
public static void EffectTurnPass(EffectCast cast) { cast.Caster.Fight.TurnEnd(); }
public static void ApplyBuffMissBack(EffectCast cast, EffectCast actualCast) { if (!actualCast.AtCac) return; int chance = cast.Value1; int push = cast.Value2; if (Utilities.Basic.Rand(0, 99) < chance) { EffectProcessor.ApplyEffect(new EffectCast(EffectEnum.PushBack, cast.SpellID, actualCast.CellID, push, -1, -1, 0, 0, false, actualCast.Caster, null, cast.Target)); actualCast.Jet = 0; } }
public static void PushBackDamages(EffectCast cast, int length, int currentLength) { int damageCoef = Utilities.Basic.Rand(8, 17); double levelCoef = cast.Caster.Level / 50; if (levelCoef < 0.1) levelCoef = 0.1; int damages = (int)Math.Floor(damageCoef * levelCoef) * (length - currentLength + 1); EffectDamage(new EffectCast(EffectEnum.DamageNeutre, cast.SpellID, damages, -1, -1, 0, 0, 0, false, cast.Caster, null, cast.Target)); }
public static void RemoveBuff(EffectCast cast) { if (!RegisteredBuffs.ContainsKey(cast.Type)) return; if (cast.Target == null) return; if (RegisteredBuffs[cast.Type][1] != null) RegisteredBuffs[cast.Type][1](cast, null); }
public void OnAttackedPostJet(EffectCast cast) { foreach (EffectCast buff in myBuffActives[BuffActiveType.ACTIVE_ATTACKED_POST_JET]) BuffProcessor.ApplyBuff(buff, cast); }
public static void RemoveBuffChangeSkin(EffectCast cast, EffectCast actualCast) { cast.Target.Skin = cast.Value2; cast.Caster.Fight.Send("GA;149;" + cast.Caster.ID + ';' + cast.Target.ID + ',' + cast.Value3 + ',' + cast.Value2); }
private bool IsDebuffable(EffectCast cast) { switch (cast.Type) { case EffectEnum.AddPA: case EffectEnum.AddPABis: case EffectEnum.AddPM: case EffectEnum.SubPA: case EffectEnum.SubPAEsquive: return false; } return true; }
public EffectCast CopyToBuff() { EffectCast cast = new EffectCast(Type, SpellID, CellID, Value1, Value2, Value3, Chance, Duration, false, Caster, null, Target); cast.Jet = Jet; return cast; }
public static void EffectIncreaseSpellDamage(EffectCast cast) { if (cast.Duration == 0) return; cast.Target = cast.Caster; cast.Caster.Buffs.AddBuff(cast, BuffActiveType.ACTIVE_ATTACK_POST_JET, BuffDecrementType.TYPE_ENDTURN); }