//MAIN BATTLE FLOW-----------------------------------------------------------------------// // start battle scene public void startBattle(GameObject new_battle) { //Reset player stats and status player.restoreToFull(); currThirdEyeCharge = maxThirdEyeCharge; battleKeyboard.clearStatus(); castManager.cooldown.removeAll(); trackTyping.clearBuffer(); trackTyping.updateDisplay(); //Reset BattleManager curr variables curr_battle = new_battle; curr_wave = -1; waves = new_battle.GetComponents <BattleWave>(); //Reset target field.target_ind = 1; StartCoroutine(finishBattlePrep()); }
//CASTING CODE//---------------------------------------------------------------------------------------------------------------------------------------// // attack currently targeted enemy with spell public bool attackCurrent(string spell, TrackTyping callback) { SpellData s; string message = ""; //Send spell, Enemy state, and target index to parser and caster CastStatus status = spellDict.parse(spell.ToLower(), out s); Pair <bool[], bool[]> targetPattern = null; callback.clearBuffer(); switch (status) { case CastStatus.SUCCESS: ++field.num_player_attacks; targetPattern = spellDict.getTargetPattern(s, field.enemy_arr, field.target_ind, field.player_arr, field.player_ind); message = chat.getLine(field.Player.Stats.ChatDatabaseID); preCastEffects(targetPattern, field.Player, s, message); AudioPlayer.main.playSFX("sfx_enter"); AudioPlayer.main.playSFX("sfx_player_cast"); AudioPlayer.main.playSFX("sfx_cast", 0.35f); AnimationPlayer.main.playAnimation("anim_spell_empower", field.Player.Transform.position, 2f); StartCoroutine(pauseAttackCurrent(s, field.Player)); return(true); //Clear the casting buffer case CastStatus.BOTCH: //diplay.playBotchEffects spellEffects.popp.spawnSprite("popups_invalid", 1.0F, field.Player.Transform.position - new Vector3(0, 0.375f, 0)); AudioPlayer.main.playSFX("sfx_enter_bad"); return(true); //Clear the casting buffer case CastStatus.FIZZLE: //diplay.playBotchEffects spellEffects.popp.spawnSprite("popups_invalid", 1.0F, field.Player.Transform.transform.position - new Vector3(0, 0.375f, 0)); AudioPlayer.main.playSFX("sfx_enter_bad"); return(true); //Clear the casting buffer case CastStatus.ONCOOLDOWN: //display.playOnCooldownEffects spellEffects.popp.spawnSprite("popups_oncooldown", 1.0F, field.Player.Transform.position - new Vector3(0, 0.375f, 0)); AudioPlayer.main.playSFX("sfx_enter_bad"); return(false); case CastStatus.COOLDOWNFULL: //diplay.playCooldownFullEffects spellEffects.popp.spawnSprite("popups_cooldownfull", 1.0F, field.Player.Transform.position - new Vector3(0, 0.375f, 0)); AudioPlayer.main.playSFX("sfx_enter_bad"); return(false); case CastStatus.ALLYSPELL: int allyPos = getAllyPosition(s.root); if (allyPos == -1 || field.player_arr[allyPos].Is_stunned || !((Ally)field.player_arr[allyPos]).tryCast()) //display.playAllyNotHereEffects { break; } targetPattern = spellDict.getTargetPattern(s, field.enemy_arr, field.target_ind, field.player_arr, allyPos); message = chat.getLine(field.player_arr[allyPos].Stats.ChatDatabaseID); preCastEffects(targetPattern, field.player_arr[allyPos], s, message); StartCoroutine(pauseAttackCurrent(s, field.player_arr[allyPos])); return(true); //Clear the casting buffer default: return(false); } return(false); }