public void OnClick(object sender, EventArgs e) { if (Game.currentActiveSkill is SingleTargetSkill) { if (MouseState.state == InputState.Targetting && !combatHandler.players.Contains(this)) { SingleTargetSkill singleTargetSkill = Game.currentActiveSkill as SingleTargetSkill; singleTargetSkill.Execute(this); MouseState.state = InputState.Idle; UpdateHealthLabel(); combatHandler.hoverIndicator.Visible = false; Game.combatHandler.NextTurn(); } } else if (Game.currentActiveSkill is HealingSkill) { if (MouseState.state == InputState.Targetting && !combatHandler.enemies.Contains(this)) { HealingSkill healingSkill = Game.currentActiveSkill as HealingSkill; healingSkill.Execute(this); MouseState.state = InputState.Idle; UpdateHealthLabel(); combatHandler.hoverIndicator.Visible = false; Game.combatHandler.NextTurn(); } } else if (Game.currentActiveSkill is StunSkill) { if (MouseState.state == InputState.Targetting && !combatHandler.players.Contains(this)) { StunSkill stunSkill = Game.currentActiveSkill as StunSkill; stunSkill.Execute(this); combatHandler.DrawStunnedStars(this); MouseState.state = InputState.Idle; UpdateHealthLabel(); combatHandler.hoverIndicator.Visible = false; Game.combatHandler.NextTurn(); } } }
public void NextTurn() { if (activeUnitIndex > 10) { return; } RemoveIcons(); if (enemies.Count > 0 && players.Count > 0) { if (activeUnitIndex < units.Count - 1) { activeUnitIndex++; activeUnit = units[activeUnitIndex]; UpdateTurnArrow(activeUnit); if (activeUnit.isStunned) { activeUnit.isStunned = false; RemoveStars(activeUnit); NextTurn(); } else { try { if (!activeUnit.isAlive) { NextTurn(); } Game.mainLogger.LogMessage("Current turn: " + activeUnit.name); } catch { NextTurn(); } if (!activeUnit.isHuman) { UpdateTurnArrow(activeUnit); SingleTargetSkill temp = activeUnit.skills[0] as SingleTargetSkill; Random r = new Random(); temp.Execute(players[r.Next(players.Count)]); try { players[0].UpdateHealthLabel(); } catch { System.Diagnostics.Debug.WriteLine("No more players."); } NextTurn(); } else { //UpdateTurnArrow(activeUnit); DrawSkills(activeUnit); } } } else { Game.mainLogger.LogMessage("======================================"); Game.mainLogger.LogMessage("Round complete!"); Game.mainLogger.LogMessage("======================================"); activeUnitIndex = -1; NextTurn(); } } else { Game.mainLogger.LogMessage("One of the groups is dead!"); if (players.Count <= 0 || enemies.Count <= 0) { End(); } } }