public virtual void User_OnCreatureMovementFinished(BJCreatureObject creatureObject) { if (creatureObject.CurrentSkill != this) // whoops :( { return; } }
public override void User_OnCreatureMovementFinished(BJCreatureObject creatureObject) { base.User_OnCreatureMovementFinished(creatureObject); if (creatureObject.CurrentSkill != this) // whoops :( { return; } moveCounter++; if (moveCounter == 1) { CurrentUser.Creature.ArmorPierce += Damage; CurrentUser.DealDamage(CurrentUser.Creature.BaseDamage, 1.0f, CurrentMainTarget); for (int i = 0; i < Effects.Count; i++) { if (Random.Range(0.0f, 0.99f) < EffectChances [i]) { Effects [i].Applier = CurrentUser; CurrentMainTarget.ApplyEffect(Effects [i], true); } } CurrentUser.Creature.ArmorPierce -= Damage; CurrentUser.MoveToPoint(CurrentUser.InitialPosition); } if (moveCounter == 2) { StartCoroutine(FinishSkill(0.1f)); } }
public void SpawnCreatures(int amount) { if (Player.Instance != null) // kostyll { List <CreatureData> enemyShipDatas = Player.Instance.CurrentMission.EnemyShips; for (int i = 0; i < enemyShipDatas.Count; i++) { BJCreature enemyCreature = enemyShipDatas [i].Creature; BJCreatureObject bjCreatureObject = SpawnCreatureObject(enemyCreature, enemyShipDatas [i].Level); bjCreatureObject.gameObject.transform.SetParent(EnemySpawnPoints [i]); bjCreatureObject.gameObject.transform.localScale = Vector3.one; bjCreatureObject.gameObject.transform.localPosition = Vector3.zero; } } else { List <BJCreature> enemyCreatures = new List <BJCreature> (BJPlayer.Instance.DataBase.EnemyCreatures); for (int i = 0; i < amount; i++) { BJCreatureObject bjCreatureObject = SpawnCreatureObject(enemyCreatures [i], 1); bjCreatureObject.gameObject.transform.SetParent(EnemySpawnPoints [i]); bjCreatureObject.gameObject.transform.localScale = Vector3.one; bjCreatureObject.gameObject.transform.localPosition = Vector3.zero; } } }
BJCreatureObject SpawnCreatureObject(BJCreature creature, int level) { GameObject creatureObject = Instantiate(CreatureObjectPrefab) as GameObject; BJCreatureObject bjCreatureObject = creatureObject.GetComponent <BJCreatureObject> (); bjCreatureObject.Creature = new BJCreature(creature.Name, creature.MaxHPByLevel, creature.HP, creature.BaseDamageByLevel, creature.Armor, creature.Speed, creature.Allegiance, /*attackType,*/ creature.SkillNames); bjCreatureObject.Creature.Level = level; //Debug.Log (creature.Name + ": " + creature.HP); //bjCreatureObject.Creature.HP = bjCreatureObject.Creature.MaxHP; //Debug.Log (creature.Name + ": " + bjCreatureObject.Creature.HP); bjCreatureObject.Creature.IsDead = false; bjCreatureObject.CreatureImage.sprite = BJPlayer.Instance.DataBase.FigurinesByNames [creature.Name]; bjCreatureObject.CreatureImage.SetNativeSize(); bjCreatureObject.CreatureImage.rectTransform.sizeDelta = new Vector2(bjCreatureObject.CreatureImage.rectTransform.rect.width / 7, bjCreatureObject.CreatureImage.rectTransform.rect.height / 7); bjCreatureObject.HPFill.color = (creature.Allegiance == Allegiance.Player) ? Color.green : Color.red; foreach (var skillName in creature.SkillNames) { BJPlayer.Instance.DataBase.BJSkillsByNames [skillName].Name = skillName; bjCreatureObject.AddSkill(BJPlayer.Instance.DataBase.BJSkillsByNames [skillName]); } if (creature.Allegiance == Allegiance.Enemy) { EnemyCreatureObjects.Add(bjCreatureObject); } else { PlayerCreatureObjects.Add(bjCreatureObject); } bjCreatureObject.OnCreatureObjectClicked += BjCreatureObject_OnCreatureObjectClicked; bjCreatureObject.OnCreatureReadyForTurn += BjCreatureObject_OnCreatureReadyForTurn; bjCreatureObject.OnCreatureTurnFinished += BjCreatureObject_OnCreatureTurnFinished; return(bjCreatureObject); }
public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; List <BJCreatureObject> ourCreatureObjects = (CurrentUser.Creature.Allegiance == Allegiance.Player) ? BJGameController.Instance.PlayerCreatureObjects : BJGameController.Instance.EnemyCreatureObjects; List <BJCreatureObject> secondaryTargets = new List <BJCreatureObject> (); foreach (var creatureObject in ourCreatureObjects) { if (creatureObject != user && TargetPriorities.ContainsKey(ourCreatureObjects.IndexOf(creatureObject)) && creatureObject.Creature.HP > 0) { secondaryTargets.Add(creatureObject); } } Effects [0].Applier = user; mainTarget.ApplyEffect(Effects [0], true); foreach (var secondaryTarget in secondaryTargets) { Effects [0].Applier = user; secondaryTarget.ApplyEffect(Effects [0], true); } StartCoroutine(FinishSkill(0.1f)); }
// public BJEffect ArmorBuffEffect; public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; List <BJCreatureObject> ourCreatureObjects = (CurrentUser.Creature.Allegiance == Allegiance.Player) ? BJGameController.Instance.PlayerCreatureObjects : BJGameController.Instance.EnemyCreatureObjects; List <BJCreatureObject> secondaryTargets = new List <BJCreatureObject> (); foreach (var creatureObject in ourCreatureObjects) { if (creatureObject != user && TargetPriorities.ContainsKey(ourCreatureObjects.IndexOf(creatureObject)) && creatureObject.Creature.HP > 0) { secondaryTargets.Add(creatureObject); } } foreach (var secondaryTarget in secondaryTargets) { foreach (var skill in secondaryTarget.Skills) { if (!skill.IsPassive) { skill.CurrentCooldown = Mathf.Max(0, skill.CurrentCooldown - 1); } } } StartCoroutine(FinishSkill(0.1f)); }
public void Attack(BJCreatureObject enemyCreature) { if (!IsAttacking) { IsAttacking = true; UseSkill(enemyCreature, CurrentSkill); } }
public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; Projectile = Instantiate(ProjectilePrefab) as GameObject; shouldMoveProjectile = true; Projectile.transform.position = new Vector3(CurrentUser.transform.position.x, CurrentUser.transform.position.y, initialZ); }
// public BJEffect AggroEffect; public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; Effects [0].Applier = user; mainTarget.ApplyEffect(Effects [0], true); StartCoroutine(FinishSkill(0.1f)); }
public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); moveCounter = 0; CurrentUser = user; CurrentMainTarget = mainTarget; float xCoord = (user.Creature.Allegiance == Allegiance.Player) ? 0.5f : -0.5f; user.MoveToPoint(mainTarget.transform.position - new Vector3(xCoord, 0.0f, 0.0f)); }
// public BJEffect ArmorBuffEffect; public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; mainTarget.Creature.Heal(Damage); StartCoroutine(FinishSkill(0.1f)); }
IEnumerator EnemyAttack(float delay, BJCreatureObject creatureObject) { yield return(new WaitForSeconds(delay)); if (CurrentCreatureObject.Creature.Allegiance == Allegiance.Player) { Debug.Log("WHAT THE F**K"); } CurrentCreatureObject.Attack(creatureObject); CurrentCreatureObject.Deanimate(); }
public void SpawnPlayerCreatures() { List <CreatureData> creatureDatas = Player.Instance.CurrentTeam; for (int i = 0; i < creatureDatas.Count; i++) { BJCreatureObject bjCreatureObject = SpawnCreatureObject(creatureDatas [i].Creature, creatureDatas [i].Level); bjCreatureObject.gameObject.transform.SetParent(PlayerSpawnPoints [i]); bjCreatureObject.gameObject.transform.localScale = Vector3.one; bjCreatureObject.gameObject.transform.localPosition = Vector3.zero; } }
public override void User_OnCreatureMovementFinished(BJCreatureObject creatureObject) { base.User_OnCreatureMovementFinished(creatureObject); if (creatureObject.CurrentSkill != this) // whoops :( { return; } if (shouldHit) { moveCounter++; } if (moveCounter < HitsAmount) { float xCoord = (CurrentUser.Creature.Allegiance == Allegiance.Player) ? 0.5f : -0.5f; if (shouldHit) { CurrentUser.DealDamage((int)(CurrentUser.Creature.BaseDamage * DamageMultiplier), 1.0f, CurrentMainTarget); for (int i = 0; i < Effects.Count; i++) { if (Random.Range(0.0f, 0.99f) < EffectChances [i]) { Effects [i].Applier = CurrentUser; CurrentMainTarget.ApplyEffect(Effects [i], true); } } CurrentUser.MoveToPoint(CurrentMainTarget.transform.position - new Vector3(xCoord, 0.0f, 0.0f)); shouldHit = false; } else { CurrentUser.MoveToPoint(CurrentMainTarget.transform.position - new Vector3(xCoord * 2, 0.0f, 0.0f)); shouldHit = true; } } if (moveCounter == HitsAmount) { CurrentUser.DealDamage((int)(CurrentUser.Creature.BaseDamage * DamageMultiplier), 1.0f, CurrentMainTarget); for (int i = 0; i < Effects.Count; i++) { if (Random.Range(0.0f, 0.99f) < EffectChances [i]) { Effects [i].Applier = CurrentUser; CurrentMainTarget.ApplyEffect(Effects [i], true); } } CurrentUser.MoveToPoint(CurrentUser.InitialPosition); } if (moveCounter > HitsAmount) { StartCoroutine(FinishSkill(0.1f)); } }
void BjCreatureObject_OnCreatureObjectClicked(BJCreatureObject creatureObject) // non-player can't click { List <BJCreatureObject> targetCreatureObjects = (CurrentCreatureObject.CurrentSkill.TargetTeam == Teams.AnotherTeam) ? BJGameController.Instance.EnemyCreatureObjects : BJGameController.Instance.PlayerCreatureObjects; if (CurrentCreatureObject != null && CurrentCreatureObject.Creature.Allegiance == Allegiance.Player) // && CurrentCreatureObject.CurrentSkill.TargetTeam == Teams.AnotherTeam) { { if (!CurrentCreatureObject.CurrentSkill.ValidTargetIndexes.Contains(targetCreatureObjects.IndexOf(creatureObject))) { return; } CurrentCreatureObject.Attack(creatureObject); CurrentCreatureObject.Deanimate(); } }
void BjCreatureObject_OnCreatureTurnFinished(BJCreatureObject creatureObject) { CheckDead(); foreach (var enemyCreatureObject in EnemyCreatureObjects) { enemyCreatureObject.SelectionCircle.gameObject.SetActive(false); } foreach (var playerCreatureObject in PlayerCreatureObjects) { playerCreatureObject.SelectionCircle.gameObject.SetActive(false); } if (CurrentCreatureObject == creatureObject) { Invoke("StartTurn", 0.25f); } }
void StartTurn() { CheckDead(); if (TurnQueue.Count == 0) { FormQueue(); } CurrentCreatureObject = TurnQueue.Dequeue(); if (CurrentCreatureObject != null && CurrentCreatureObject.Creature.HP <= 0) { StartTurn(); return; } CurrentCreatureChooseSkill(0); CurrentCreatureObject.GetReadyForTurn(); }
public void DealDamage(int damage, float multiplier, BJCreatureObject enemy) { foreach (var effect in enemy.Effects) { if (effect is BJDelayDamageEffect) { (effect as BJDelayDamageEffect).DelayedDamage += damage; return; } if (effect is BJAdjustmentFireEffect && effect.Applier == this) { damage += effect.Damage; } } Creature.DealDamage(damage, multiplier, enemy.Creature); }
public override void User_OnCreatureMovementFinished(BJCreatureObject creatureObject) { base.User_OnCreatureMovementFinished(creatureObject); if (creatureObject.CurrentSkill != this) // whoops :( { return; } moveCounter++; if (moveCounter == 1) { CurrentUser.DealDamage((int)CurrentUser.Creature.BaseDamage, 1.0f, CurrentMainTarget); CurrentUser.MoveToPoint(CurrentUser.InitialPosition); } if (moveCounter == 2) { StartCoroutine(FinishSkill(0.1f)); } }
public void ReformQueue(BJCreatureObject injectedCreatureObject) { List <BJCreatureObject> allCreaturesList = new List <BJCreatureObject> (); foreach (var creatureObject in TurnQueue) { if (creatureObject.Creature.HP > 0) { allCreaturesList.Add(creatureObject); } } if (injectedCreatureObject != null) { allCreaturesList.Add(injectedCreatureObject); } allCreaturesList.Sort((x, y) => y.Creature.Speed.CompareTo(x.Creature.Speed)); TurnQueue = new Queue <BJCreatureObject> (allCreaturesList); }
public override void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { base.UseSkill(user, mainTarget); CurrentUser = user; CurrentMainTarget = mainTarget; List <BJCreatureObject> enemyCreatureObjects = (CurrentUser.Creature.Allegiance == Allegiance.Player) ? BJGameController.Instance.EnemyCreatureObjects : BJGameController.Instance.PlayerCreatureObjects; CurrentSecondaryTargets = new List <BJCreatureObject> (); foreach (var creatureObject in enemyCreatureObjects) { if (creatureObject.Creature.HP > 0) { CurrentSecondaryTargets.Add(creatureObject); } } Utility.Shuffle(CurrentSecondaryTargets); Projectile = Instantiate(ProjectilePrefab) as GameObject; shouldMoveProjectile = true; Projectile.transform.position = new Vector3(CurrentUser.transform.position.x, CurrentUser.transform.position.y, initialZ); }
public void UseSkill(BJCreatureObject target, BJSkill skill) { skill.UseSkill(this, target); }
public virtual void UseSkill(BJCreatureObject user, BJCreatureObject mainTarget) { CurrentCooldown = Cooldown; }
void BjCreatureObject_OnCreatureReadyForTurn(BJCreatureObject creatureObject) { CurrentCreatureObject.StartTurn(); for (int i = 0; i < SkillButtons.Count; i++) { BJSkillButton skillButton = SkillButtons [i].GetComponent <BJSkillButton> (); skillButton.ReadyParticlesObject.SetActive(false); if (i >= CurrentCreatureObject.Skills.Count - 1) { SkillButtons [i].interactable = false; skillButton.CooldownSlider.maxValue = 0; skillButton.CooldownSlider.value = 0; skillButton.CooldownLabel.gameObject.SetActive(false); } else if (CurrentCreatureObject.Skills [i + 1].IsPassive) { SkillButtons [i].interactable = false; skillButton.CooldownSlider.maxValue = 0; skillButton.ButtonImage.sprite = CurrentCreatureObject.Skills [i + 1].SkillIcon; skillButton.CooldownSlider.value = 0; skillButton.CooldownLabel.gameObject.SetActive(false); } else { SkillButtons [i].interactable = true; skillButton.ButtonImage.sprite = CurrentCreatureObject.Skills [i + 1].SkillIcon; skillButton.CooldownSlider.maxValue = CurrentCreatureObject.Skills [i + 1].Cooldown; skillButton.CooldownSlider.value = CurrentCreatureObject.Skills [i + 1].CurrentCooldown; if (CurrentCreatureObject.Skills [i + 1].CurrentCooldown > 0) { skillButton.CooldownLabel.gameObject.SetActive(true); skillButton.CooldownLabel.text = CurrentCreatureObject.Skills [i + 1].CurrentCooldown + ""; } else { skillButton.ReadyParticlesObject.SetActive(true); skillButton.CooldownLabel.gameObject.SetActive(false); } } } if (CurrentCreatureObject != null && CurrentCreatureObject.Creature.Allegiance == Allegiance.Enemy && PlayerCreatureObjects.Count > 0) { CheckDead(); int index = 0; int indexOfIndex = 0; do { indexOfIndex = Random.Range(0, CurrentCreatureObject.CurrentSkill.ValidTargetIndexes.Count); index = CurrentCreatureObject.CurrentSkill.ValidTargetIndexes[indexOfIndex]; } while (PlayerCreatureObjects.Count <= index || PlayerCreatureObjects[index].Creature.HP <= 0); foreach (var playerCreatureObject in PlayerCreatureObjects) { foreach (var effect in playerCreatureObject.Effects) { if (playerCreatureObject.Creature.HP > 0 && effect is BJAggroEffect) { index = PlayerCreatureObjects.IndexOf(playerCreatureObject); } } } StartCoroutine(EnemyAttack(0.25f, PlayerCreatureObjects[index])); } }