public bool ApplyRegion(Spell spell, SpellInBattle spellInBattle) { if (logic.unitsInRegions.Count == 0) { Destroy(gameObject); return(false); } this.spell = spell; this.spellInBattle = spellInBattle; hasApplied = true; GetComponent <Image>().color = Color.white; logic.EffectFunction(); for (int i = 0; i < logic.unitsInRegions.Count; i++) { logic.unitsInRegions[i].SetStandartColor(); } if (spell.InstantAction) { RegionSpellExecute(2); } EnemyControll.enemyControll.regions.Add(this); return(true); }
public void Start() { if (spellImage == null) { Destroy(gameObject); return; } GetComponent <Image>().sprite = spellImage.uImage.img; if (spellImage.splashType == Spell.SplashType.Field) { byRegion = true; } if (spellInBattle != null) { spellInBattle.spellImage = spellImage; } if (!started) { if (!byRegion) { GetComponent <Button>().onClick.AddListener(() => Select()); } spellInBattle = new SpellInBattle(transform, spellImage); started = true; } }
private void RefreshSpells() { spells = new SpellInBattle[unitObject.Spells.Length]; if (unitObject.Spells.Length > 0) { for (int i = 0; i < unitObject.Spells.Length; i++) { unitObject.Spells[i].unitEvents.MyUnit = this; spells[i] = new SpellInBattle(transform, unitObject.Spells[i], true); if (spells[i].spellImage.passiveSettings.IsPassiveSkill && spells[i].spellImage.unitEvents.BattleCry.GetPersistentEventCount() > 0) { spells[i].spellImage.unitEvents.BattleCry.Invoke(); } } } }
public void JustHitStrategy() { Transform enemies = BattleControll.battleControll.enemyUnitsParent.transform; for (int i = 0; i < regions.Count; i++) { if (!regions[i].NextTurnRepose(1)) { regions.RemoveAt(i); } } for (int i = 0; i < enemies.childCount; i++) { UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>(); enamy.NextTurnRepose(Effect.actionCall.OnStartTurn); if (NeedRefreshPos) { PositionReload(enamy); } if (enamy.unitlogic.totem != null) { enamy.unitlogic.totem.Execute(Effect.actionCall.OnStartTurn); } } BattleControll.heroLogic.LinkedSpells(); for (int i = 0; i < enemies.childCount; i++) { UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>(); int act = enamy.unitlogic.UnitAction; if (enamy.unitlogic.attackType != null) { SpellPart sp = enamy.unitlogic.attackType.AvailableSpell; if (sp.Available(enamy.unitlogic.attackType)) { try { switch (sp.spell.spellTarget) { case Spell.SpellTarget.Enemy & Spell.SpellTarget.Alies: sp.spell.Execute(null, BattleControll.heroLogic); break; case Spell.SpellTarget.Enemy: sp.spell.Execute(null, BattleControll.heroLogic); break; case Spell.SpellTarget.Alies: break; default: sp.spell.Execute(null, null, true); break; } } catch { Debug.Log("eerr"); } finally { enamy.unitlogic.UnitAction -= sp.spell.EnergyCost; act -= sp.spell.EnergyCost; } } } if (enamy.spells.Length > 0) { for (int sp = 0; sp < enamy.spells.Length; sp++) { SpellInBattle spell = enamy.spells[sp]; if (spell.spellImage.passiveSettings.IsPassiveSkill) { continue; } if (spell.Reloading()) { if (spell.spellImage.spellTarget == Spell.SpellTarget.Enemy) { spell.Realizeto(enamy, BattleControll.heroLogic); enamy.unitlogic.UnitAction--; act -= spell.spellImage.EnergyCost; } } } } if (enamy.unitlogic.CanAttack(BattleControll.heroLogic)) { for (int q = 0; q < act; q++) { if (enamy.unitlogic.UnitAction > 0) { enamy.unitlogic.AttackUnit(BattleControll.heroLogic, 1); } } BattleLogic.battleLogic.addAction(null, null, -1, 0.5f); } } for (int i = 0; i < regions.Count; i++) { if (!regions[i].NextTurnRepose(0)) { regions.RemoveAt(i); } } for (int i = 0; i < enemies.childCount; i++) { UnitLogic enamy = enemies.GetChild(i).GetComponent <UnitLogic>(); enamy.EffectsTick(Effect.actionCall.OnEndTurn); if (enamy.unitlogic.totem != null) { enamy.unitlogic.totem.Execute(Effect.actionCall.OnEndTurn); } } NeedRefreshPos = false; BattleLogic.battleLogic.addAction(() => { BattleControll.battleControll.SpawnEnemies(); GoToFirstLine(); TurnController.turnController.NextTurn(); RealizeLogicToNextTurn(); }, null); }