// ------------------------------------------------------------------------------- // PlayerCastSpell (Post Selection) // ------------------------------------------------------------------------------- public void PlayerCastSpell(InstanceSkill instance, CharacterBase[] targets) { Finder.ui.ActivateBattleCommands(false); if (targets != null) { Finder.ui.PopState(); Finder.ui.ActivateBattleCommands(false); if (currentCharacter.CommandCastSpell(instance, targets)) { if (instance.template.getCharacterActionType == CharacterActionType.PlayerExitBattle) { ForceEndBattle(); } else { currentCharacter.BattleTurnFinished = true; } } } else { PlayerCancel(); } }
// ------------------------------------------------------------------------------- // ExecuteEventActions // ------------------------------------------------------------------------------- protected void ExecuteEventActions(int id) { if (currentNode.choiceActions.Length == 0 || currentNode.choiceActions.Length < id || currentNode.choiceActions[id] == null) { return; } bool wait = false; // --------------------------------------------------------------------------- Play Sound Finder.audio.PlaySFX(currentNode.choiceActions[id].soundEffect); // --------------------------------------------------------------------------- Costs foreach (TemplateItem tmpl in currentNode.choiceActions[id].removeItems) { Finder.party.inventory.AddItem(tmpl, -1); } foreach (TemplateCharacterHero tmpl in currentNode.choiceActions[id].removeHeroes) { Finder.party.DismissHero(tmpl); } foreach (AbilityLevel tmpl in currentNode.choiceActions[id].castAbilities) { CharacterBase target = Finder.party.HasAbility(tmpl.template, tmpl.level); if (target != null) { target.MP -= tmpl.template.GetCost(tmpl.level); } } if (currentNode.choiceActions[id].removeCurrencyAmount != 0) { Finder.party.currencies.setResource(currentNode.choiceActions[id].currencyType, currentNode.choiceActions[id].removeCurrencyAmount * -1); } // --------------------------------------------------------------------------- Rewards foreach (TemplateCharacterHero tmpl in currentNode.choiceActions[id].addHeroes) { if (tmpl.checkQuantity) { Finder.party.AddHero(tmpl); } } if (currentNode.choiceActions[id].addItems.Length > 0) { RPGHelper.DropLoot(currentNode.choiceActions[id].addItems.ToList()); } Finder.party.AddExperience(currentNode.choiceActions[id].addExperience); // --------------------------------------------------------------------------- Attack Party if (currentNode.choiceActions[id].attackAbility != null) { bool targetAll = false; if (currentNode.choiceActions[id].attackTarget == InteractableEventTarget.All) { targetAll = true; } InstanceSkill instance = new InstanceSkill(currentNode.choiceActions[id].attackAbility, currentNode.choiceActions[id].attackAbilityLevel); ActionDamage(instance, targetAll); } // --------------------------------------------------------------------------- Cure Party if (currentNode.choiceActions[id].curativeAbility != null) { bool targetAll = false; if (currentNode.choiceActions[id].attackTarget == InteractableEventTarget.All) { targetAll = true; } InstanceSkill instance = new InstanceSkill(currentNode.choiceActions[id].curativeAbility, currentNode.choiceActions[id].curativeAbilityLevel); ActionRecover(instance, targetAll); } // --------------------------------------------------------------------------- Manipulate other Event foreach (InteractableEventAction tmpl in currentNode.choiceActions[id].events) { string name = string.Format("{0}_{1}", tmpl.targetX, tmpl.targetY); GameObject go = GameObject.Find(name); DungeonObjectEvent co = go.GetComponent <DungeonObjectEvent>(); if (go == null || co == null) { Debug.Log(string.Format("Error: No event for condition at {0}/{1}", tmpl.targetX, tmpl.targetY)); } if (tmpl.targetActivation == BoolType.True) { co.Activate(); } else if (tmpl.targetActivation == BoolType.False) { co.Deactivate(); } if (tmpl.targetInteraction == BoolType.True) { co.AddInteraction(); } else if (tmpl.targetInteraction == BoolType.False) { co.RemoveInteraction(); } } // --------------------------------------------------------------------------- Manipulate this Event if (currentNode.choiceActions[id].eventActivation == BoolType.True) { Activate(); } else if (currentNode.choiceActions[id].eventActivation == BoolType.False) { Deactivate(); } if (currentNode.choiceActions[id].eventInteraction == BoolType.True) { AddInteraction(); } else if (currentNode.choiceActions[id].eventInteraction == BoolType.False) { RemoveInteraction(); } // --------------------------------------------------------------------------- Animate Event if (currentNode.choiceActions[id].moveDirection != MoveType.None) { moveDirection = currentNode.choiceActions[id].moveDirection; IsMoving = true; } // --------------------------------------------------------------------------- Teleportation if (currentNode.choiceActions[id].teleport.locationType != LocationType.None) { Finder.map.TeleportPlayer(currentNode.choiceActions[id].teleport); } // --------------------------------------------------------------------------- Open Shop if (currentNode.choiceActions[id].openShop != null) { Finder.ui.OverrideShopState(currentNode.choiceActions[id].openShop); Finder.ui.PushState(UIState.ShopOutside); } // --------------------------------------------------------------------------- Start Combat if (currentNode.choiceActions[id].startCombat) { int BattlePoolId = currentNode.choiceActions[id].battlePoolId; int BattleEncLevel = currentNode.choiceActions[id].battleEncounterLevel; int BattleEncAmountMin = currentNode.choiceActions[id].battleEncounterAmountMin; int BattleEncAmountMax = currentNode.choiceActions[id].battleEncounterAmountMax; bool BattleEncAmountScale = currentNode.choiceActions[id].battleEncounterAmountScale; Finder.battle.StartBattle(BattlePoolId, BattleEncLevel, BattleEncAmountMin, BattleEncAmountMax, BattleEncAmountScale, !tile.TriggerOnce); wait = true; } // --------------------------------------------------------------------------- Complete Event StartCoroutine(WaitForCompletion(id, wait)); }