public void AddMob(int mobId, int slotId) { if (_battle.State.Data == null) { return; } var mob = -1; foreach (var temp in _battle.State.Data.Enemies) { if (temp.Value.Position == slotId) { mob = temp.Key; } } if (mob != -1) { _battle.State.Data.Enemies.Remove(mob); } if (mobId == -1) { return; } if (_battle.LiveEnemies.Count() < HardCodeIds.MaxBattleSlots) { _battle.State.Data.CurrentId++; _battle.State.Data.Enemies[_battle.State.Data.CurrentId] = _battleLogic.CreateBattleMob(mobId, slotId, false); } }
public override void Execute(IUnitImpactSummon data) { //if (!data.Transform) //{ if (_battle.LiveEnemies.Count() < HardCodeIds.MaxBattleSlots) { var currentPositions = _battle.State.Data.Enemies.Where(x => x.Value.Status == UnitBattleStatus.Live).Select(x => x.Value.Position).ToArray(); int position = 0; if (data.SlotId != 0 && !currentPositions.Contains(data.SlotId)) { position = data.SlotId; } if (position == 0) { for (var i = 1; i < HardCodeIds.MaxBattleSlots; i++) { if (!currentPositions.Contains(i)) { position = i; break; } } if (position == 0) { return; } } _battle.State.Data.CurrentId++; _battle.State.Data.Enemies[_battle.State.Data.CurrentId] = _battleLogic.CreateBattleMob(data.MobId, position, true); } //} //else //{ // var battleMob = _contextLogic.CurrentTarget; // var mob = _battleLogic.CreateBattleMob(data.MobId, battleMob.Position, true); // //mob.CurrentHp = battleMob.CurrentHp; // foreach (var temp in battleMob.Abilities) // { // mob.Abilities[temp.Key] = temp.Value; // } // _battle.State.Data.Enemies[_contextLogic.CurrentContext.CurrentTarget] = mob; //} }