private void enemyAction(ActionType action, ExploreCat cat) { if (cat.currentHealth <= 0) { cat.onHit(AttackType.None, cat); return; } Debug.Log("enemy action!"); Dialogue[] D = DataUtils.defaultReaction(action, //random user Cat cat.target.cat); for (int i = 0; i < D.Length; i++) { if (D[i].speaker == CatType.none) { D[i].speaker = cat.cat.catType; } else { D[i].speaker = controller.userPlayer.allCats[0].cat.catType; } } ExploreCat user = controller.userPlayer.allCats[0]; controller.exploreStory.InitStory(D, user, controller.enemyPlayer.allCats); controller.exploreStory.Finished += () => { cat.onHit(AttackType.None, cat); ExploreChoice.defaultResponse(action, cat); }; }
protected void onHit() { Debug.Log("onHit: callOnHit:" + callOnHit); if (callOnHit && owner.onHit != null) { owner.onHit(AttackType.Ranged, owner); } }
// private bool hasPlayerWon() // { // if (enemyPlayer.getNumLivingCats() == 0) // { // return true; // } // return false; // } // private bool hasPlayerLost() // { // if (userPlayer.getNumLivingCats() == 0) // { // return true; // } // return false; // } private void sideEffectReact(SideEffect effect, ExploreCat effectee) { string[] effectNotifs = null; string secondstring = null; float damage = 0; // if (cat.owner.enemy) // { // exploreChoice.getCurrentUser().Disable(); // } switch (effect.effect) { case Fx.Love: effectNotifs = new string[] { effectee.cat.Name + " loves their foe too much to focus!", effectee.cat.Name + " likes their foe so much that they refuse to battle.", effectee.cat.Name + " is too distracted by their love for their foe to pay attention!", effectee.cat.Name + " is too busy feeling adoration for their foe!", effectee.cat.Name + " wants to make friends, not war!", }; if (UnityEngine.Random.value > 0.6f) { damage = effectee.realizedStats.maxHealth * 0.025f; secondstring = effectee.cat.Name + " feels hurt at the thought of fighting!"; } break; case Fx.Confused: effectNotifs = new string[] { effectee.cat.Name + " is too confused by the " + effect.effector.ToString().ToLower() + " to fight!", effectee.cat.Name + " is too bewildered by the " + effect.effector.ToString().ToLower() + " to attack!", effectee.cat.Name + " is caught off guard by the " + effect.effector.ToString().ToLower() + "!", effectee.cat.Name + " is confused; they've never seen a " + effect.effector.ToString().ToLower() + " before!", }; if (UnityEngine.Random.value > 0.75f) { damage = effectee.realizedStats.maxHealth * 0.05f + 1; secondstring = effectee.cat.Name + " got hurt in their confusion!"; } break; case Fx.Distracted: effectNotifs = new string[] { effectee.cat.Name + " is too distracted by the " + effect.effector.ToString().ToLower() + " to attack!", effectee.cat.Name + " bats the " + effect.effector.ToString().ToLower() + " happily, forgetting to attack!", effectee.cat.Name + " is too busy playing with the " + effect.effector.ToString().ToLower() + " to attack!", effectee.cat.Name + " ignores the fight to paw at the " + effect.effector.ToString().ToLower() + "!", }; break; case Fx.Scared: effectNotifs = new string[] { effectee.cat.Name + "'s too scared of the " + effect.effector.ToString().ToLower() + " to move!", effectee.cat.Name + " is frozen in fear of the " + effect.effector.ToString().ToLower() + "!", effectee.cat.Name + " is too frightened of the " + effect.effector.ToString().ToLower() + " to do anything!", }; if (UnityEngine.Random.value > 0.45f) { damage = effectee.realizedStats.maxHealth * 0.05f + 2; secondstring = effectee.cat.Name + " got hurt in their fright!"; } break; } if (effectNotifs != null) { if (effectee.currentHealth <= 0) { effectee.onHit(AttackType.None, effectee); return; } if (effectee.owner.enemy) { exploreChoice.getCurrentUser().Disable(); } string[] notifs = (secondstring == null) ? new string[] { effectNotifs[UnityEngine.Random.Range(0, effectNotifs.Length)] } : new string[] { effectNotifs[UnityEngine.Random.Range(0, effectNotifs.Length)], secondstring }; Notify(notifs, () => { effectee.onHit(AttackType.None, effectee); if (damage > 0) { effectee.takeDamage(damage); } }); effectee.setEffect(); } }