public override bool Execute(TileScript tile) { CharacterScript enemy = tile.GetTileInhabitant(); if(enemy) { int distance = player.map.GetAStar().GetRangeBetweenTwoTiles(player.currentTile,tile); if(distance <= range) { //int abilityCostModifier = tile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.ReduceAbilityCost); //TODO:add these back in. //- abilityCostModifier; if(player.stamina >= staminaCost ) { int damageModifier = tile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.IncreaseDamage); enemy.health -= damage + damageModifier; //+ damageModifier; //- abilityCostModifier player.stamina -= (staminaCost); Debug.Log("Hit Enemies for " + damage + " damage to " + enemy.health + " health"); GameManagerScript gm = player.gm; AudioManagerScript am = gm.gameObject.GetComponent<AudioManagerScript>(); am.PlayAudioClip(BAConstants.AudioConstants.AudioClipType.SwordHit1); return true; } } } return false; }
//we wish to see if the player can execute their ability on the given tile coordinate public override bool ValidateMove(ref int expectedStamina, TileScript expectedTilePosition, TileScript targetTile) { int distance = 99; CharacterScript enemy = targetTile.GetTileInhabitant(); switch(player.characterType) { case BAConstants.CharacterConstants.CharacterType.player: { if(enemy.characterType == CharacterConstants.CharacterType.enemy) { distance = player.map.GetAStar().GetRangeBetweenTwoTiles(expectedTilePosition,targetTile); if(distance <= range) { int abilityCostModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.DecreaseAbilityCost); if(player.stamina >= staminaCost - abilityCostModifier) { return true; } } } break; } case BAConstants.CharacterConstants.CharacterType.enemy: { distance = player.map.GetAStar().GetRangeBetweenTwoTiles(expectedTilePosition,targetTile); if(distance <= range) { if(enemy.characterType == CharacterConstants.CharacterType.player) { int increaseAbilityCostModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.IncreaseEnemyAbilityCost); if(player.stamina >= staminaCost + increaseAbilityCostModifier) { return true; } } } break; } } return false; }
public override bool ValidateMove(ref int expectedStamina, TileScript expectedTilePosition, TileScript targetTile) { CharacterScript enemy = targetTile.GetTileInhabitant(); if(enemy == null) { List<Vector2> pathToTile = player.map.GetAStar().GetPathBetweenTwoTiles(expectedTilePosition,targetTile); if(pathToTile.Count > 0) { //Reduce the count cost by since it includes the movers current position. int totalStaminaCost = staminaCost * (pathToTile.Count-1); int totalAbilityCostModifier = 0; //remove target location tile since we don't need to check //for it's ability cost modifiers pathToTile.RemoveAt(pathToTile.Count-1); foreach(Vector2 tileCoordinate in pathToTile) { TileScript currentTileInPath = (TileScript)player.map.GetTiles()[tileCoordinate]; totalAbilityCostModifier += currentTileInPath.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.DecreaseAbilityCost); } if(player.stamina >= (totalStaminaCost - totalAbilityCostModifier)) { return true; } } } return false; }
public override bool ValidateMove(ref int expectedStamina, TileScript expectedTilePosition, TileScript targetTile) { CharacterScript enemy = targetTile.GetTileInhabitant(); if(enemy) { if(enemy.characterType != player.characterType && expectedStamina >= staminaCost) { return true; } } return false; }
public override bool Execute(TileScript tile) { CharacterScript enemy = tile.GetTileInhabitant(); if(enemy) { int distance = player.map.GetAStar().GetRangeBetweenTwoTiles(player.currentTile,tile); if( distance <= range) { if(player.stamina >= staminaCost) { enemy.health -= damage; player.stamina -= staminaCost; Debug.Log("Throwing Rock at Player for " + damage + " damage to " + enemy.health + " health"); return true; } } } return false; }
public override bool Execute(TileScript tile) { CharacterScript enemy = tile.GetTileInhabitant(); if(enemy) { switch(player.characterType) { case CharacterConstants.CharacterType.player: { int distance = player.map.GetAStar().GetRangeBetweenTwoTiles(player.currentTile,tile); if(distance <= range) { int abilityCostModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.DecreaseAbilityCost); if(player.stamina >= staminaCost - abilityCostModifier) { int damageModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.IncreaseDamage); enemy.health -= (damage + damageModifier); player.stamina -= (staminaCost - abilityCostModifier); Debug.Log("Hitting Enemy for " + damage + " damage to " + enemy.health + " health"); GameManagerScript gm = player.gm; AudioManagerScript am = gm.gameObject.GetComponent<AudioManagerScript>(); am.PlayAudioClip(BAConstants.AudioConstants.AudioClipType.SwordHit1); return true; } } break; } case CharacterConstants.CharacterType.enemy: { int distance = player.map.GetAStar().GetRangeBetweenTwoTiles(player.currentTile,tile); if(distance <= range) { int increaseAbilityCostModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.IncreaseEnemyAbilityCost); if(player.stamina >= staminaCost + increaseAbilityCostModifier) { int decreaseDamageModifier = player.currentTile.GetNumOfFavorEffectsInTile(ConstantsScript.TileFavorEffect.DecreaseEnemyDamage); enemy.health -= (damage - decreaseDamageModifier); player.stamina -= (staminaCost + increaseAbilityCostModifier); Debug.Log("Hitting Player for " + damage + " damage to " + enemy.health + " health"); GameManagerScript gm = player.gm; AudioManagerScript am = gm.gameObject.GetComponent<AudioManagerScript>(); am.PlayAudioClip(BAConstants.AudioConstants.AudioClipType.EnemyAttack); //JONATHAN: ENEMY HITS PLAYER HERE. return true; } } break; } } } return false; }
public override bool Execute(TileScript tile) { CharacterScript enemy = tile.GetTileInhabitant(); if(enemy) { int distance = player.map.GetAStar().GetRangeBetweenTwoTiles(player.currentTile,tile); if( distance <= range) { if(player.stamina >= staminaCost) { enemy.health -= damage; player.stamina -= staminaCost; //TODO: push enemy 1 hex away from player Debug.Log("Pushing player"); return true; } } } return false; }