public static Effectiveness DetermineAttackEffect(Spell.SpellType attacker, Spell.SpellType defender) { Character.Effectiveness effect = Character.Effectiveness.NORMAL; switch (attacker) { case Spell.SpellType.GROUND: switch (defender) { case Spell.SpellType.GROUND: effect = Character.Effectiveness.NORMAL; break; case Spell.SpellType.LIGHTNING: effect = Character.Effectiveness.SUPER; break; case Spell.SpellType.WATER: effect = Character.Effectiveness.REDUCED; break; } break; case Spell.SpellType.LIGHTNING: switch (defender) { case Spell.SpellType.GROUND: effect = Character.Effectiveness.REDUCED; break; case Spell.SpellType.LIGHTNING: effect = Character.Effectiveness.NORMAL; break; case Spell.SpellType.WATER: effect = Character.Effectiveness.SUPER; break; } break; case Spell.SpellType.WATER: switch (defender) { case Spell.SpellType.GROUND: effect = Character.Effectiveness.SUPER; break; case Spell.SpellType.LIGHTNING: effect = Character.Effectiveness.REDUCED; break; case Spell.SpellType.WATER: effect = Character.Effectiveness.NORMAL; break; } break; } return(effect); }
public void StartEffect(Spell.SpellType aType) { int index = m_Types.IndexOf(aType); if (m_Prefabs[index] != null) { GameObject.Instantiate(m_Prefabs[index]); } }
/// <summary> /// Is the unit stack affected by a spell of this type? /// </summary> /// <param name="spellType">The spell type to check</param> /// <returns>Whether the unit stack is affected by a spell of a particular type</returns> public bool IsAffectedBy(Spell.SpellType spellType) { for (int i = 0; i < _affectingSpells.Count; i++) { if (_affectingSpells[i].GetSpellType() == spellType) { return(true); } } return(false); }
/// <summary> /// Get unit type's spells of a specific type /// </summary> /// <param name="spellType">Spell type to search for</param> /// <returns>List of unit type's spells of this spell type</returns> public List <Spell> GetSpellsOfType(Spell.SpellType spellType) { List <Spell> result = new List <Spell>(); for (int i = 0; i < _spells.Count; i++) { if (_spells[i].GetSpellType() == spellType) { result.Add(_spells[i]); } } return(result); }
public void PowerUp(Spell.SpellType spellType) { switch (spellType) { case Spell.SpellType.GROUND: break; case Spell.SpellType.LIGHTNING: break; case Spell.SpellType.WATER: break; } }
/// <summary> /// Shows the attack selection for magic attacks if the spell needs that. /// </summary> /// <param name="magicType"></param> public void MagicAttackSelect(int magicType) { currentAttackType = (AttackType)magicType; Spell.SpellType type = magicController.spells[magicType - 1].reference.spellType; Debug.Log("Magicindex: " + (magicType - 1) + ", Type: " + type.ToString()); if (type == Spell.SpellType.SINGLE) { selectCanvas.enabled = true; } else { Attack(-1); } }
/// <summary> /// Sets up combat participants and parameters /// </summary> /// <param name="province">Combat location</param> /// <param name="attackers">A list of attacking unit stacks</param> /// <param name="defenders">A list of defending unit stacks</param> /// <param name="isRealCombat">Whether the combat takes place or whether a Strategos simulates it during planning phase</param> public Combat(Province province, List <UnitStack> attackers, List <UnitStack> defenders, bool isRealCombat) { _province = province; _attackers = attackers; _defenders = defenders; _attackerRollResults = new List <AttackRollResultsCollection>(); _defenderRollResults = new List <AttackRollResultsCollection>(); _currentTurn = 1; _currentPhase = 0; _currentSpellType = Spell.SpellType.UNIT_CREATION; _isDefenderPC = isRealCombat && province.GetOwnersFaction().IsPC(); _isAttackerPC = isRealCombat && _attackers[0].GetProvinceToRetreat().GetOwnersFaction().IsPC(); _attackingTactician = _attackers[0].GetProvinceToRetreat().GetOwnersFaction().GetTactician(); _defendingTactician = province.GetOwnersFaction().GetTactician(); }
public void StartEffect(Spell.SpellType aType) { m_SpellDictionary.StartEffect(aType); }
/// <summary> /// Performs actions appropriate for the phase, like generating attack roll results or casting spells /// </summary> public void PerformPhaseActions() { if (_attackerRollResults.Count == 0 && _defenderRollResults.Count == 0) { PerformEndOfCombatCheck(); bool noPlayerAttentionNeeded = true; while (noPlayerAttentionNeeded) { // setting phase description before advancing to the next phase _phaseDescription = _currentPhase.ToString(); if (_currentPhase == TurnPhase.START) { for (int i = 0; i < _attackers.Count; i++) { _attackers[i].ActivateSpellLikeAbilities(); } for (int i = 0; i < _defenders.Count; i++) { _defenders[i].ActivateSpellLikeAbilities(); } } if (_currentPhase == TurnPhase.MAGIC) { if (_currentSpellType == Spell.SpellType.UNIT_CREATION) { bool unitsSummoned = CastUnitCreationSpells(); _currentSpellType = Spell.SpellType.DEFENSIVE; if (unitsSummoned) { return; } } if (_currentSpellType == Spell.SpellType.DEFENSIVE) { bool spellsCast = CastDefensiveSpells(); _currentSpellType = Spell.SpellType.OFFENSIVE; if (spellsCast) { return; } } if (_currentSpellType == Spell.SpellType.OFFENSIVE) { CastOffensiveSpells(); _currentSpellType = Spell.SpellType.UNIT_CREATION; } } bool unitsHealed = false; if (_currentPhase == TurnPhase.DIVINE) { unitsHealed = CastRestorativeSpells(_attackers); unitsHealed = CastRestorativeSpells(_defenders) || unitsHealed; } RollAttacks(_attackers, _attackerRollResults); RollAttacks(_defenders, _defenderRollResults); AdvancePhase(); noPlayerAttentionNeeded = _attackerRollResults.Count == 0 && _defenderRollResults.Count == 0 && _currentPhase != 0 && !unitsHealed; } } }
public Sprite GetSprite(Spell.SpellType aType) { int index = m_Types.IndexOf(aType); return(m_Sprites[index]); }