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 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; } } }
public CreatureData(BJCreature creature, int level, List <Skill> skills, Item soulstone, RankColor rankColor, bool isSummoned) { Creature = creature; Name = creature.Name; Allegiance = creature.Allegiance; Level = level; Creature.Level = Level; // MaxHP = creature.MaxHP; // HP = creature.MaxHP; Attack = creature.BaseDamage; Soulstone = soulstone; LevelCosts = Player.Instance.DataBase.LevelCosts; LevelGoldCosts = Player.Instance.DataBase.LevelGoldCosts; StatNames = new List <string> { "MaxHP", "Attack", "Armor", "Speed" }; RankColor = rankColor; if (skills != null) { Skills = new List <Skill> (skills); } else { Skills = new List <Skill> (); } IsSummoned = isSummoned; }
void CreatureObject_Creature_OnCreatureDied(BJCreature sender) { if (Victim.CurrentSkill.CurrentMainTarget.Creature == sender && BJGameController.Instance.CurrentCreatureObject == Victim) { int tempSpeed = Victim.Creature.Speed; Victim.Creature.Speed = 100; foreach (var skill in Victim.Skills) { skill.CurrentCooldown = 0; } BJGameController.Instance.ReformQueue(Victim); Victim.Creature.Speed = tempSpeed; } }
public void DealDamage(int damage, float multiplier, BJCreature enemy) { float diceRoll = Random.Range(0.0f, 0.99f); if (precision > diceRoll) { damage = (int)(damage * multiplier); enemy.TakeDamage(damage, armorPierce); } else { OnMiss(0); Debug.Log("Miss!"); } }
void CreatureObject_Creature_OnCreatureDied(BJCreature sender) { Victim.Creature.Speed += Damage; BJGameController.Instance.ReformQueue(null); }
void Start() { List <int> maxHpByLevel = new List <int> { 0, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280 }; List <int> baseDamageByLevel = new List <int> { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; Creatures.Add(new BJCreature("Brawler", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 1, 1, Allegiance.Player, /*AttackType.Melee,*/ new List <string> { "Melee attack", "Aggro", /*"Delay damage", "Cheer team",*/ "Dodge buff" })); maxHpByLevel = new List <int> { 0, 70, 90, 110, 130, 150, 170, 190, 210, 230, 250 }; baseDamageByLevel = new List <int> { 0, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 }; Creatures.Add(new BJCreature("Cutthroat", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 2, 4, Allegiance.Player, /*AttackType.Melee,*/ new List <string> { "Melee attack", /*"Heart strike",*/ "Flurry", /*"Blinding strike",*/ "Bleed buff" })); maxHpByLevel = new List <int> { 0, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220 }; baseDamageByLevel = new List <int> { 0, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 }; Creatures.Add(new BJCreature("Hunter", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 1, 2, Allegiance.Player, /*AttackType.Ranged,*/ new List <string> { "Ranged attack", "Headshot", /*"Shoot leg", "Shoot hand",*/ "Adjustment fire" })); maxHpByLevel = new List <int> { 0, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220 }; baseDamageByLevel = new List <int> { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; Creatures.Add(new BJCreature("Witch", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 1, 3, Allegiance.Player, /*AttackType.Ranged,*/ new List <string> { "Ranged attack", /*"Mass regen",*/ "Heal", /*"Berserk",*/ "Sacrifice" })); maxHpByLevel = new List <int> { 0, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240 }; baseDamageByLevel = new List <int> { 0, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 }; Creatures.Add(new BJCreature("Bandit", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 4, 4, Allegiance.Player, /*AttackType.Melee,*/ new List <string> { "Melee attack", "Combo", /*"Ricochet", "Execution",*/ "Lifesteal" })); maxHpByLevel = new List <int> { 0, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220 }; baseDamageByLevel = new List <int> { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; Creatures.Add(new BJCreature("Alchemist", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 1, 4, Allegiance.Player, /*AttackType.Ranged,*/ new List <string> { "Ranged attack", "Blinding strike", "Corrosion" })); maxHpByLevel = new List <int> { 0, 110, 130, 150, 170, 190, 210, 230, 250, 270, 290 }; baseDamageByLevel = new List <int> { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; BJCreature skeletonCaptain = new BJCreature("Skeleton captain", maxHpByLevel, maxHpByLevel [1], baseDamageByLevel, 4, 1, Allegiance.Enemy, /*AttackType.Melee,*/ new List <string> { "Melee attack" }); EnemyCreatures.Add(skeletonCaptain); maxHpByLevel = new List <int> { 0, 65, 85, 105, 125, 145, 165, 185, 205, 225, 245 }; baseDamageByLevel = new List <int> { 0, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 }; BJCreature skeletonMilitia = new BJCreature("Skeleton militia", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 3, 4, Allegiance.Enemy, /*AttackType.Melee,*/ new List <string> { "Melee attack" }); EnemyCreatures.Add(skeletonMilitia); maxHpByLevel = new List <int> { 0, 35, 55, 75, 95, 115, 135, 155, 175, 195, 215 }; baseDamageByLevel = new List <int> { 0, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70 }; BJCreature skeletonArbalest = new BJCreature("Skeleton arbalest", maxHpByLevel, maxHpByLevel [1], baseDamageByLevel, 2, 2, Allegiance.Enemy, /*AttackType.Ranged,*/ new List <string> { "Ranged attack" }); EnemyCreatures.Add(skeletonArbalest); BJCreature skeletonOgre = new BJCreature("Skeleton ogre", maxHpByLevel, maxHpByLevel [1], baseDamageByLevel, 4, 1, Allegiance.Enemy, /*AttackType.Melee,*/ new List <string> { "Melee attack", "Armor buff" }); maxHpByLevel = new List <int> { 0, 90, 110, 130, 150, 170, 190, 210, 230, 250, 270 }; baseDamageByLevel = new List <int> { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; EnemyCreatures.Add(skeletonOgre); maxHpByLevel = new List <int> { 0, 70, 90, 110, 130, 150, 170, 190, 210, 230, 250 }; baseDamageByLevel = new List <int> { 0, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 }; Creatures.Add(new BJCreature("Executioner", maxHpByLevel, maxHpByLevel[1], baseDamageByLevel, 2, 4, Allegiance.Player, /*AttackType.Melee,*/ new List <string> { "Melee attack", "Execution", "Bloodlust" })); maxHpByLevel = new List <int> { 0, 35, 55, 75, 95, 115, 135, 155, 175, 195, 215 }; baseDamageByLevel = new List <int> { 0, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 }; BJCreature skeletonWitch = new BJCreature("Skeleton witch", maxHpByLevel, maxHpByLevel [1], baseDamageByLevel, 2, 2, Allegiance.Enemy, /*AttackType.Ranged,*/ new List <string> { "Ranged attack" }); EnemyCreatures.Add(skeletonWitch); FigurinesByNames = new Dictionary <string, Sprite> (); CreaturePortraitsByNames = new Dictionary <string, Sprite> (); for (int i = 0; i < CreatureNames.Count; i++) { FigurinesByNames.Add(CreatureNames [i], CharacterFigurines [i]); if (i < CharacterPortraits.Count) { CreaturePortraitsByNames.Add(CreatureNames [i], CharacterPortraits [i]); } } BJSkillsByNames = new Dictionary <string, BJSkill> (); for (int i = 0; i < SkillNames.Count; i++) { BJSkillsByNames.Add(SkillNames [i], Skills [i]); Skills [i].Name = SkillNames [i]; } SkillsByNames = new Dictionary <string, Skill> (); foreach (var bjskillByName in BJSkillsByNames) { SkillsByNames.Add(bjskillByName.Key, new Skill(bjskillByName.Value, 1, 5, new List <int> { 10, 20, 30, 40, 50 })); } EnemySets = new List <List <BJCreature> > { new List <BJCreature> { skeletonMilitia, skeletonCaptain, skeletonArbalest }, new List <BJCreature> { skeletonMilitia, skeletonCaptain, skeletonWitch }, new List <BJCreature> { skeletonMilitia, skeletonMilitia, skeletonArbalest }, new List <BJCreature> { skeletonMilitia, skeletonCaptain, skeletonArbalest, skeletonArbalest }, new List <BJCreature> { skeletonMilitia, skeletonCaptain, skeletonArbalest, skeletonWitch }, new List <BJCreature> { skeletonMilitia, skeletonMilitia, skeletonArbalest }, new List <BJCreature> { skeletonMilitia, skeletonMilitia, skeletonWitch } }; }