public ArmyFightCM() { } //JSON Constructor public ArmyFightCM(ArmyFightCM armyFight) { this.AttackIslandID = armyFight.AttackIslandID; this.AttackCount = armyFight.AttackCount; this.AttackPlayerID = armyFight.AttackPlayerID; this.AttackRetreateAvalible = armyFight.AttackRetreateAvalible; this.DefenceIslandID = armyFight.DefenceIslandID; this.DefenceCount = armyFight.DefenceCount; this.DefencePlayerID = armyFight.DefencePlayerID; this.DefenceFortressCount = armyFight.DefenceFortressCount; this.DefenceRetreateAvalible = armyFight.DefenceRetreateAvalible; this.IsMinotaurus = armyFight.IsMinotaurus; }
protected override UnitOfWork GetUnitOfWorkImpl(Context context) { int deffencePlayerID = context.map.Islands[islandToID].OwnerID; int defenceCount = context.map.GetArmyCountByIsland(islandToID, deffencePlayerID); bool isMinotaurus = context.map.IsThereCreatureOnIsland(Card.Minotaur, islandToID); //TODO minotaurus? if (deffencePlayerID == playerID || defenceCount == 0 && !isMinotaurus) { UnitOfWork uow= new UOW_Move() { playerID = playerID, islandFromID = islandFromID, islandToID = islandToID, count = count, gold = gold, pegasus = IsPegusus, changeOwner = (deffencePlayerID != playerID) }; return uow; } else { ArmyFightCM armyFight = new ArmyFightCM() { AttackIslandID = islandFromID, AttackCount = count, AttackPlayerID = playerID, AttackRetreateAvalible = context.map.CanPlayerRetreatFromIsland(islandToID, playerID), DefenceIslandID = islandToID, DefenceCount = defenceCount, DefencePlayerID = deffencePlayerID, DefenceFortressCount = context.map.GetBuildCountAtIsland(islandToID, Build.Mars, true), DefenceRetreateAvalible = context.map.CanPlayerRetreatFromIsland(islandToID, deffencePlayerID), IsMinotaurus = isMinotaurus }; UnitOfWork uow = new UOW_Fight() { playerID = playerID, islandFromID = islandFromID, islandToID = islandToID, count = count, gold = gold, pegasus = IsPegusus, armyFight = armyFight }; return uow; } }
internal void DestroyArmyFight() { armyFight = null; if (OnDestroyArmyFight != null) OnDestroyNavyFight(); }
internal void CreateArmyFight(ArmyFightCM copy) { armyFight = new ArmyFightCM(copy); if (OnCreateArmyFight!= null) OnCreateArmyFight(); }