protected override void onTouchAtBeginTurn(Fighter target) { this.Triggered(target); if (Duration == -1) { Dispose(); } CastSpell.Initialize(); var Effects = CastSpell.Effects; List <Fighter> listTarget = new List <Fighter>() { target }; var Targets = new Dictionary <EffectInfos, List <Fighter> >(); Effects.ForEach(x => Targets.Add(x, listTarget)); var ActualChance = 0; foreach (var Effect in Effects) { if (Effect.Chance > 0) { if (Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance)) { ActualChance += Effect.Chance; continue; } ActualChance -= 100; } // Actualisation des morts if (Targets[Effect][0].Dead) { continue; } /* if (this.fight is MonsterFight && Caster is CharacterFighter) * this.fight.Challanges.ForEach(x => x.CheckSpell(Caster, Effect, new List<Fighter> { target }, target.CellId));*/ List <Fighter> item = new List <Fighter>(); item.Add(Targets[Effect][0]); var CastInfos = new EffectCast(Effect.EffectType, CastSpell.SpellCache.ID, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance, Effect.Duration, Caster, Targets[Effect], false, EffectEnum.None, 0, Effect.Spell); if (EffectBase.TryApplyEffect(CastInfos) == -3) { break; } } if (!this.Fight.TryEndFight()) { this.Fight.onApplyGroundLayer(this, Caster, CastSpell, target.CellId, target, Targets); } }
public override void onWalkOnLayer(Fighter fighter, FightCell newCell) { this.Triggered(fighter); List <FightCell> myCells = new List <FightCell>(); myCells.AddRange(this.myCells); Dispose(); // Combat encore en cour ? if (this.Fight.FightState != Fights.FightState.STATE_ACTIVE) { return; } // La cible si elle existe var TargetE = this.Fight.HasEnnemyInCell(CellId, Caster.Team); long TargetId = TargetE == null ? -1 : TargetE.ActorId; CastSpell.Initialize(); var Effects = CastSpell.Effects; if (Effects == null) { Effects = CastSpell.CriticEffects; } var Targets = new Dictionary <EffectInfos, List <Fighter> >(); foreach (var Effect in Effects) { Targets.Add(Effect, new List <Fighter>()); foreach (var FightCell in myCells) { if (FightCell != null) { if (FightCell.HasGameObject(FightObjectType.OBJECT_FIGHTER) | FightCell.HasGameObject(FightObjectType.OBJECT_STATIC)) { Targets[Effect].AddRange(FightCell.GetObjects <Fighter>()); } } } if (!Targets[Effect].Contains(fighter)) { Targets[Effect].Add(fighter); } } var ActualChance = 0; foreach (var Effect in Effects) { if (Effect.Chance > 0) { if (Fight.RANDOM.Next(1, 100) > (Effect.Chance + ActualChance)) { ActualChance += Effect.Chance; continue; } ActualChance -= 100; } // Actualisation des morts Targets[Effect].RemoveAll(F => F.Dead); var CastInfos = new EffectCast(Effect.EffectType, CastSpell.SpellCache.ID, CellId, Effect.Value1, Effect.Value2, Effect.Value3, Effect.Chance, Effect.Duration, Caster, Targets[Effect], false, EffectEnum.None, 0, Effect.Spell); if (EffectBase.TryApplyEffect(CastInfos) == -3) { break; } } if (!this.Fight.TryEndFight()) { this.Fight.onApplyGroundLayer(this, Caster, CastSpell, CellId, fighter, Targets); } }