public void TestMethod() { //arrange List <BaseCards> Cards4Battle1 = new List <BaseCards>(); Cards4Battle1.Add(_firedragon); Cards4Battle1.Add(_waterSpell); Cards4Battle1.Add(_fireork); Cards4Battle1.Add(_normalSpell); List <BaseCards> Cards4Battle2 = new List <BaseCards>(); Cards4Battle2.Add(_waterdragon); Cards4Battle2.Add(_waterKnight); Cards4Battle2.Add(_fireWizard); Cards4Battle2.Add(_normaloSpello); //act int sieger = BattleLogic.StartBattle(Cards4Battle1, Cards4Battle2); //assert Assert.AreNotEqual(sieger, 0); //0 wird returnt, wenn fehler }
public void AddShowMark(COM_PLAYERCAMP targetCamp, HorizonConfig.ShowMark sm, int count) { if (this._campMarkers != null) { if (targetCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT) { for (int i = 0; i < this._campMarkers.Length; i++) { CampMarker marker = this._campMarkers[i]; bool ruleVisible = marker.RuleVisible; marker.AddShowMark(sm, count); Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); if (((hostPlayer != null) && (marker.RuleVisible != ruleVisible)) && (i == BattleLogic.MapOtherCampIndex(base.actor.TheActorMeta.ActorCamp, hostPlayer.PlayerCamp))) { this.RefreshVisible(); } } } else { int index = BattleLogic.MapOtherCampIndex(base.actor.TheActorMeta.ActorCamp, targetCamp); if ((index >= 0) && (index < this._campMarkers.Length)) { CampMarker marker2 = this._campMarkers[index]; bool flag2 = marker2.RuleVisible; marker2.AddShowMark(sm, count); Player player2 = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); if (((player2 != null) && (marker2.RuleVisible != flag2)) && (targetCamp == player2.PlayerCamp)) { this.RefreshVisible(); } } } } }
public void Init(BattleLogic battleLogic) { fightOwner = battleLogic.GetCharacterWithID(ownerID); spellInfo.owner = fightOwner; foreach (var effect in spellInfo.spellEffectInfos) { effect.SetTarget(battleLogic.GetCharacterWithID(effect.targetCharacterID)); } DivineDebug.Log("FightAction Owner: " + fightOwner.moniker); DivineDebug.Log("SpellEffectInfo Count: " + spellInfo.spellEffectInfos.Count); for (int j = 0; j < spellInfo.spellEffectInfos.Count; j++) { DivineDebug.Log("EffectOnCharacter: " + spellInfo.spellEffectInfos[j].effectOnCharacter); DivineDebug.Log("GeneratedAP: " + spellInfo.generatedActionPoint); if (spellInfo.spellEffectInfos[j].targetCharacter != null) { DivineDebug.Log("Target: " + spellInfo.spellEffectInfos[j].targetCharacter.moniker); } if (spellInfo.spellEffectInfos[j].finalCharacterStats != null) { DivineDebug.Log("Final HP: " + spellInfo.spellEffectInfos[j].finalCharacterStats.hp); } DivineDebug.Log("singleStatChanges Count: " + spellInfo.spellEffectInfos[j].singleStatChanges.Count); for (int k = 0; k < spellInfo.spellEffectInfos[j].singleStatChanges.Count; k++) { DivineDebug.Log("Stat change type: " + spellInfo.spellEffectInfos[j].singleStatChanges[k].charStatChangeType.ToString() + " value: " + spellInfo.spellEffectInfos[j].singleStatChanges[k].intVal.ToString()); } } }
public static void OnGameOverEvent(CSPkg msg) { if (Singleton <BattleLogic> .instance.isWaitGameEnd) { return; } if (msg.stPkgData.stNtfCltGameOver.bWinCamp > 0) { COM_PLAYERCAMP playerCamp = Singleton <GamePlayerCenter> .instance.GetHostPlayer().PlayerCamp; Singleton <BattleLogic> .instance.battleStat.iBattleResult = (((byte)playerCamp == msg.stPkgData.stNtfCltGameOver.bWinCamp) ? 1 : 2); COM_PLAYERCAMP camp; if (Singleton <BattleLogic> .instance.battleStat.iBattleResult == 1) { camp = BattleLogic.GetOppositeCmp(playerCamp); } else { camp = playerCamp; } BattleLogic.ForceKillCrystal((int)camp); } Singleton <CSurrenderSystem> .instance.DelayCloseSurrenderForm(5); }
public void EnemyAttackDamageStep() { battleLogic = GameObject.Find("Scene Manager").GetComponent <BattleLogic>(); switch (randomIndex) { case 0: enemyAttackText.text = enemyAttackNames[randomIndex] + " was super effective"; break; case 1: enemyAttackText.text = ""; break; case 2: enemyAttackText.text = enemyAttackNames[randomIndex] + " was not very effective"; break; default: break; } battleLogic.PlayerTakeDamage(damageEnemyDeal[randomIndex]); //GameObject go = Instantiate(attackParticles[randomIndex],new Vector3(0, 0, 0), Quaternion.identity); //Destroy(go,2); }
public static void PrepareData() { BattleLogic instance = Singleton <BattleLogic> .instance; if (!FogOfWar.enable || !instance.isFighting) { return; } SLevelContext curLvelContext = instance.GetCurLvelContext(); if (curLvelContext == null || curLvelContext.m_horizonEnableMethod != Horizon.EnableMethod.EnableAll) { return; } GameFowManager instance2 = Singleton <GameFowManager> .instance; GameFowCollector collector = instance2.m_collector; collector.UpdateFowVisibility(false); collector.CollectExplorer(false); if (Singleton <FrameSynchr> .instance.CurFrameNum % instance2.GPUInterpolateFrameInterval == 0u) { FogOfWar.CommitToMaterials(); } }
public override bool SetExposeMark(bool exposed, COM_PLAYERCAMP targetCamp, bool bIgnoreAlreadyLit) { if (this._campMarkers != null) { if (targetCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT) { for (int i = 0; i < this._campMarkers.Length; i++) { this._campMarkers[i].Exposed = exposed; } } else { int num = BattleLogic.MapOtherCampIndex(this.actor.TheActorMeta.ActorCamp, targetCamp); if (num >= 0 && num < this._campMarkers.Length) { this._campMarkers[num].Exposed = exposed; } } this.StatHideMark(HorizonConfig.HideMark.INVALID, 0, false); return(true); } return(false); }
public void UninitForInvisibleBullet() { if (this.actor == null) { return; } if (this.actor.BuffHolderComp != null) { this.actor.BuffHolderComp.ClearBuff(); } if (this.actor.HorizonMarker != null) { COM_PLAYERCAMP[] othersCmp = BattleLogic.GetOthersCmp(this.actor.TheActorMeta.ActorCamp); for (int i = 0; i < othersCmp.Length; i++) { if (this.actor.HorizonMarker.HasHideMark(othersCmp[i], HorizonConfig.HideMark.Skill)) { this.actor.HorizonMarker.AddHideMark(othersCmp[i], HorizonConfig.HideMark.Skill, -1, true); } } this.actor.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Skill, false, true); this.actor.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Jungle, false, true); } }
public static bool OnSkillFuncInvisible(ref SSkillFuncContext inContext) { PoolObjHandle <ActorRoot> inTargetObj = inContext.inTargetObj; if (inTargetObj != 0) { if (inContext.inStage == ESkillFuncStage.Enter) { inTargetObj.handle.HorizonMarker.AddHideMark(COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT, HorizonConfig.HideMark.Skill, 1); } else if (inContext.inStage == ESkillFuncStage.Leave) { COM_PLAYERCAMP[] othersCmp = BattleLogic.GetOthersCmp(inTargetObj.handle.TheActorMeta.ActorCamp); for (int i = 0; i < othersCmp.Length; i++) { if (inTargetObj.handle.HorizonMarker.HasHideMark(othersCmp[i], HorizonConfig.HideMark.Skill)) { inTargetObj.handle.HorizonMarker.AddHideMark(othersCmp[i], HorizonConfig.HideMark.Skill, -1); } } } } return(true); }
public void TestMethod1() { TestCase1[] testSet = new TestCase1[] { new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 1, 100 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 1, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 1, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 1, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 150 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 200 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 150 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 0, 200 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 0, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 150 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 200 } }, null), result = false }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 150 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), result = true }, new TestCase1 { army1 = new Fleet(0, new Dictionary <int, int> { { 2, 200 } }, null), army2 = new Fleet(0, new Dictionary <int, int> { { 2, 100 } }, null), result = true } }; foreach (TestCase1 testCase in testSet) { Assert.IsTrue(BattleLogic.ArrangeBattle(testCase.army1, testCase.army2) == testCase.result); Assert.IsTrue(testCase.result ? testCase.army2.IsEmpty : testCase.army1.IsEmpty); } }
private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex) { switch (chooseType) { case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP: { List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors; int count = heroActors.get_Count(); for (int i = 0; i < count; i++) { if (heroActors.get_Item(i).handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && heroActors.get_Item(i).handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(heroActors.get_Item(i).handle); } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE: { if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.handle); } List <Player> allPlayers = Singleton <GamePlayerCenter> .instance.GetAllPlayers(); if (allPlayers != null) { int count2 = allPlayers.get_Count(); for (int j = 0; j < count2; j++) { if (!(allPlayers.get_Item(j).Captain == attacker) && allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && this.IsActorInRange(allPlayers.get_Item(j).Captain, target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!allPlayers.get_Item(j).Captain.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { if (allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call) { CallActorWrapper callActorWrapper = allPlayers.get_Item(j).Captain.handle.ActorControl as CallActorWrapper; if (callActorWrapper != null) { relatedHeros.Add(callActorWrapper.GetHostActor()); } } else { relatedHeros.Add(allPlayers.get_Item(j).Captain.handle); } } } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL: if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.handle); } break; case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST: { HashSet <uint> assistSet = BattleLogic.GetAssistSet(target, attacker, true); HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator(); while (enumerator.MoveNext()) { PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current()); if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(actor.handle); } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL: { if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.handle); } HashSet <uint> assistSet2 = BattleLogic.GetAssistSet(target, attacker, true); HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator(); while (enumerator2.MoveNext()) { PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current()); if (actor2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.handle) && (!actor2.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(actor2.handle); } } break; } } }
public void ShowAttackInfo(CharacterLogic currentCharacterLogic, CharacterLogic logic) { WeaponItem equipWeapon = currentCharacterLogic.Info.Items.GetEquipWeapon(); var def = ResourceManager.GetWeaponDef(equipWeapon.ID); int afterHP = currentCharacterLogic.GetCurrentHP() - BattleLogic.GetAttackDamage(logic, currentCharacterLogic); Left_BattleAttackInfo.Show(currentCharacterLogic.GetPortrait(), def.Icon, def.CommonProperty.Name, currentCharacterLogic.GetMaxHP(), currentCharacterLogic.GetCurrentHP(), afterHP, currentCharacterLogic.GetHit(), BattleLogic.GetAttackDamage(currentCharacterLogic, logic), currentCharacterLogic.GetCritical(), BattleLogic.GetAttackCount(currentCharacterLogic, logic)); equipWeapon = logic.Info.Items.GetEquipWeapon(); def = ResourceManager.GetWeaponDef(equipWeapon.ID); afterHP = logic.GetCurrentHP() - BattleLogic.GetAttackDamage(currentCharacterLogic, logic); Right_BattleAttackInfo.Show(logic.GetPortrait(), def.Icon, def.CommonProperty.Name, logic.GetMaxHP(), logic.GetCurrentHP(), afterHP, logic.GetHit(), BattleLogic.GetAttackDamage(logic, currentCharacterLogic), logic.GetCritical(), BattleLogic.GetAttackCount(logic, currentCharacterLogic)); }
private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex) { switch (chooseType) { case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP: { List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors; int count = heroActors.Count; for (int i = 0; i < count; i++) { PoolObjHandle <ActorRoot> handle3 = heroActors[i]; if (handle3.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp) { PoolObjHandle <ActorRoot> handle4 = heroActors[i]; if (handle4.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { PoolObjHandle <ActorRoot> handle5 = heroActors[i]; if (!handle5.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { PoolObjHandle <ActorRoot> handle6 = heroActors[i]; relatedHeros.Add(handle6.handle); } } } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE: { if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))) { relatedHeros.Add(attacker.handle); } List <PoolObjHandle <ActorRoot> > list2 = Singleton <GameObjMgr> .instance.HeroActors; int num3 = list2.Count; for (int j = 0; j < num3; j++) { if (list2[j] != attacker) { PoolObjHandle <ActorRoot> handle7 = list2[j]; if (handle7.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp) { PoolObjHandle <ActorRoot> handle8 = list2[j]; if ((handle8.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && this.IsActorInRange(list2[j], target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius)) { PoolObjHandle <ActorRoot> handle9 = list2[j]; if (!handle9.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { PoolObjHandle <ActorRoot> handle10 = list2[j]; relatedHeros.Add(handle10.handle); } } } } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL: if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))) { relatedHeros.Add(attacker.handle); } break; case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST: { HashSet <uint> .Enumerator enumerator = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator(); while (enumerator.MoveNext()) { PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.Current); if ((actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!actor.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))) { relatedHeros.Add(actor.handle); } } break; } case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL: { if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))) { relatedHeros.Add(attacker.handle); } HashSet <uint> .Enumerator enumerator2 = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator(); while (enumerator2.MoveNext()) { PoolObjHandle <ActorRoot> handle2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.Current); if (((handle2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && !relatedHeros.Contains(handle2.handle)) && (!handle2.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))) { relatedHeros.Add(handle2.handle); } } break; } } }
public static CheatModule CreateClient(UnitsAccessor _units, ScorersAccessor _scorers, BattleAccessor _battle, InventoryAccessor _inventory, PlayerAccessor _player, ExplorerAccessor _explorer, LogAccessor _accessor, SettingsAccessor _settings, ExplorerLogic _explorerLogic, BattleLogic _battleLogic, ContextLogic _contextLogic, ImpactController _logic, DropLogic _drop, ScorersLogic _scorerLogic) { return(new CheatModule { _units = _units, _scorers = _scorers, _battle = _battle, _inventory = _inventory, _player = _player, _explorer = _explorer, _accessor = _accessor, _settings = _settings, _explorerLogic = _explorerLogic, _battleLogic = _battleLogic, _contextLogic = _contextLogic, _logic = _logic, _drop = _drop, _scorerLogic = _scorerLogic, } ); }
private void OnGUI() { GUILayout.Label("Queue:"); BattleLogic logic = BattleLogic.battleLogic; if (logic != null) { string s0 = " BattleQueue: "; for (int i = 0; i < logic.BattleQueue.Count; i++) { s0 += logic.BattleQueue[i].Method.Name; } GUILayout.Label(s0); string s1 = " MyTurnQueue: "; for (int i = 0; i < logic.MyturnQueue.Count; i++) { s1 += logic.MyturnQueue[i].unityAction.Method.Name; } GUILayout.Label(s1); string s2 = " NextTurnQueue: "; for (int i = 0; i < logic.NextTurnQueue.Count; i++) { s2 += logic.NextTurnQueue[i].unityAction.Method.Name; } GUILayout.Label(s2); } GUILayout.Label("Enemies:"); if (BattleControll.battleControll != null) { GridGroup gridGroup = BattleControll.battleControll.enemyUnitsParent; selectedPopup = EditorGUILayout.Popup("GridType", selectedPopup, new string[] { "UnitNames", "UnitAvailability", "MissChanse", "MissChanseOnMe", "CanAttack" }); for (int y = 0; y < gridGroup.units.GetLength(1); y++) { string s = ""; for (int x = 0; x < gridGroup.units.GetLength(0); x++) { if (selectedPopup == 0) { s += (gridGroup.units[x, y] != null) ? gridGroup.units[x, y].UnitName + " " : " _ "; } else if (selectedPopup == 1) { s += (gridGroup.units[x, y] != null) ? gridGroup.units[x, y].unitlogic.HasBlocked() + " " : " ___ "; } else if (selectedPopup == 2) { s += (gridGroup.units[x, y] != null) ? gridGroup.units[x, y].unitlogic.MissChanse(BattleControll.heroLogic.unitlogic) + " " : " _ "; } else if (selectedPopup == 3) { s += (gridGroup.units[x, y] != null) ? BattleControll.heroLogic.unitlogic.MissChanse(gridGroup.units[x, y].unitlogic) + " " : " _ "; } else { s += (gridGroup.units[x, y] != null) ? gridGroup.units[x, y].unitlogic.CanAttack(BattleControll.heroLogic) + " " : " ___ "; } } GUILayout.Label(" " + s); } } }
public override void ResolvePray(BattleLogic logic) { logic.Heal(1, logic.AllEnemy()); }
public override void ResolveEffect(BattleLogic logic, Character[] targets) { logic.Heal(3, logic.player); }
public UnitImpactSummonExecutor(ContextLogic contextLogic, BattleAccessor battle, BattleLogic battleLogic) { _contextLogic = contextLogic; _battleLogic = battleLogic; _battle = battle; }
public override void ResolvePray(BattleLogic logic) { logic.Damage(4, logic.RandomAny()); }
public abstract void ResolvePray(BattleLogic logic);
public abstract void ResolveEffect(BattleLogic logic, Character[] targets);
private void Init() { m_BattleLogic = BattleLogic.instance; m_BattleLogic.Init(); }
public override void ResolvePray(BattleLogic logic) { logic.Heal(3, logic.player); }
//Public Methods public void SetBattleLogic(BattleLogic battleLogic) { _battleLogic = battleLogic; }
public void LifeCycle(TimeSpan GameStepDuration, MainWindow window) { if (Active == true) { CreditsStep(); PopulationStep(); GoodsStep(); if (Behavior == BehaviorType.Aggressor) { if (attackCycle % 4 == 0 && Army.TotalArmy() >= ArmyLimit / 2 && Hut.Lvl >= 2) { attackCycle++; Army army = new Army(Army.SpeedUnits / 3, Army.AttackUnits / 3, Army.DefenceUnits / 3); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); logic.AttackEnemy(); } else if (attackCycle % 3 == 0 && Army.TotalArmy() >= ArmyLimit / 2 && Hut.Lvl >= 3) { attackCycle++; Army army = new Army(Army.SpeedUnits / 2, Army.AttackUnits / 2, Army.DefenceUnits / 2); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); logic.AttackEnemy(); } else if (attackCycle % 3 == 0 && Army.TotalArmy() >= ArmyLimit / 2 && Hut.Lvl >= 4) { attackCycle++; Army army = new Army(Army.SpeedUnits, Army.AttackUnits, Army.DefenceUnits); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); logic.AttackEnemy(); } if (Army.TotalArmy() <= ArmyLimit / 2 && Hut.Lvl >= 2) { attackCycle++; ArmyCreation(0, GetMaxNumberOfArmyCreation(), 0); } if (GetUpdatePrice(Hut)[0] <= Credits && GetUpdatePrice(Hut)[1] <= Goods && Hut.Lvl <= 5) { attackCycle++; BuildingLvlUp(Hut); } else if (Wall.Lvl <= 3) { attackCycle++; BuildingLvlUp(Wall); } else if (BaseLvl < 3) { attackCycle++; BaseLvlUp(); } } else if (Behavior == BehaviorType.Builder) { Building building = GetBuildingWithMinimalLvl(); if (GetUpdatePrice(building)[0] <= Credits / 2 && GetUpdatePrice(building)[1] <= Goods / 2 && building.Lvl < 3) { attackCycle++; BuildingLvlUp(building); } if (Army.TotalArmy() > ArmyLimit / 3 && attackCycle % 3 == 0) { attackCycle++; Army army = new Army(Army.SpeedUnits / 2, Army.AttackUnits, Army.DefenceUnits / 2); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); logic.AttackEnemy(); } if ((BaseLvl <= building.Lvl - 2) && BaseLvl <= 3) { attackCycle++; BaseLvlUp(); } else if (building.Lvl == 2 && Army.TotalArmy() < ArmyLimit / 2) { attackCycle++; ArmyCreation(0, 0, GetMaxNumberOfArmyCreation()); } else if (GetUpdatePrice(building)[0] <= Credits && GetUpdatePrice(building)[1] <= Goods && building.Lvl < 3) { attackCycle++; BuildingLvlUp(building); } else if (building.Lvl >= 3 && Army.TotalArmy() < ArmyLimit * 0.7) { attackCycle++; ArmyCreation(0, GetMaxNumberOfArmyCreation() / 2, GetMaxNumberOfArmyCreation() / 3); } else if (attackCycle % 2 == 0) { attackCycle++; ArmyCreation(0, GetMaxNumberOfArmyCreation(), 0); Army army = new Army(Army.SpeedUnits / 2, Army.AttackUnits, Army.DefenceUnits / 2); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); logic.AttackEnemy(); } } else if (Behavior == BehaviorType.Traider) { if (GetUpdatePrice(Workshop)[0] <= Credits && GetUpdatePrice(Workshop)[1] <= Goods && Workshop.Lvl < 4) { attackCycle++; BuildingLvlUp(Workshop); } if (GetUpdatePrice(Portal)[0] <= Credits && GetUpdatePrice(Portal)[1] <= Goods && Portal.Lvl < 4) { attackCycle++; BuildingLvlUp(Portal); } if (Army.TotalArmy() < ArmyLimit * 0.7 && BaseLvl < 3) { attackCycle++; ArmyCreation(0, 0, GetMaxNumberOfArmyCreation()); } else if (GetBaseUpdatePrice()[0] == Credits && GetBaseUpdatePrice()[1] == Goods && BaseLvl <= 3) { attackCycle++; BaseLvlUp(); } else if (GetMaxNumberOfArmyCreation() >= (Army.TotalArmy() - ArmyLimit) / 2) { attackCycle++; ArmyCreation(0, GetMaxNumberOfArmyCreation(), 0); } else if (Army.TotalArmy() == ArmyLimit && GetMaxNumberOfArmyCreation() == ArmyLimit) { attackCycle++; Army army = new Army(Army.SpeedUnits, Army.AttackUnits, Army.DefenceUnits); BattleLogic logic = new BattleLogic(this, army, Enemies, GameStepDuration, false, window); ArmyCreation(0, GetMaxNumberOfArmyCreation(), 0); } } } else { SetImage(Position[0], Position[1], "Image/grass.png", window); } }
public override void ResolvePray(BattleLogic logic) { logic.Damage(2, logic.All()); }
public static BattleModule CreateClient(BattleAccessor _battle, ExplorerAccessor _explorer, UnitsAccessor _units, ContextLogic _contextLogic, ImpactController _impactLogic, TriggerLogic _triggerLogic, BattleLogic _battleLogic, BuffLogic _buffLogic) { return(new BattleModule { _battle = _battle, _explorer = _explorer, _units = _units, _contextLogic = _contextLogic, _impactLogic = _impactLogic, _triggerLogic = _triggerLogic, _battleLogic = _battleLogic, _buffLogic = _buffLogic, } ); }
private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex) { switch (chooseType) { case 1: { List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .get_instance().HeroActors; int count = heroActors.get_Count(); for (int i = 0; i < count; i++) { if (heroActors.get_Item(i).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors.get_Item(i).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(heroActors.get_Item(i).get_handle()); } } break; } case 2: { if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.get_handle()); } List <PoolObjHandle <ActorRoot> > heroActors2 = Singleton <GameObjMgr> .get_instance().HeroActors; int count2 = heroActors2.get_Count(); for (int j = 0; j < count2; j++) { if (!(heroActors2.get_Item(j) == attacker)) { if (heroActors2.get_Item(j).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors2.get_Item(j).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && this.IsActorInRange(heroActors2.get_Item(j), target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!heroActors2.get_Item(j).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(heroActors2.get_Item(j).get_handle()); } } } break; } case 3: if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.get_handle()); } break; case 4: { HashSet <uint> assistSet = BattleLogic.GetAssistSet(target, attacker, true); HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator(); while (enumerator.MoveNext()) { PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current()); if (actor.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(actor.get_handle()); } } break; } case 5: { if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(attacker.get_handle()); } HashSet <uint> assistSet2 = BattleLogic.GetAssistSet(target, attacker, true); HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator(); while (enumerator2.MoveNext()) { PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current()); if (actor2.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.get_handle()) && (!actor2.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)) { relatedHeros.Add(actor2.get_handle()); } } break; } } }
public static StartSessionModule CreateClient(UnitsAccessor _units, ScorersAccessor _scorers, BattleAccessor _battle, InventoryAccessor _inventory, PlayerAccessor _player, ExplorerAccessor _explorer, LogAccessor _accessor, SettingsAccessor _settings, ShopAccessor _shop, LogAccessor _log, AchievementAccessor _achievement, BattleLogic _battleLogic, ShopLogic _shopLogic, ExplorerLogic _explorerLogic, FormulaController _formula, ImpactController _logic) { return(new StartSessionModule { _units = _units, _scorers = _scorers, _battle = _battle, _inventory = _inventory, _player = _player, _explorer = _explorer, _accessor = _accessor, _settings = _settings, _shop = _shop, _log = _log, _achievement = _achievement, _battleLogic = _battleLogic, _shopLogic = _shopLogic, _explorerLogic = _explorerLogic, _formula = _formula, _logic = _logic, } ); }
//- 设置调用的宿主 // // @param unit 调用的宿主 // @return none public void setCallUnit(BattleLogic unit) { m_callUnit = unit; }