public float DefenceCheck(AbilityStats AS) { float totalDamageAfterDefence = 0f; float totalDefence = baseDefence + otherDefence; float fireCheck = 0f; float waterCheck = 0f; float earthCheck = 0f; float windCheck = 0f; if (AS.baseDamage < totalDefence) { totalDamageAfterDefence += AS.baseDamage - totalDefence; } if (AS.fireDamage < fireResistance) { fireCheck = AS.fireDamage - fireResistance; } if (AS.waterDamage < waterResistance) { waterCheck = AS.waterDamage - waterResistance; } if (AS.earthDamage < earthResistance) { earthCheck = AS.earthDamage - earthResistance; } if (AS.windDamange < windResistance) { windCheck = AS.windDamange - windResistance; } totalDamageAfterDefence = totalDamageAfterDefence + fireCheck + waterCheck + earthCheck + windCheck; // Elemental effects take a percent return(totalDamageAfterDefence); }
// See if yuou can clean this up a littl public void Damaged(AbilityStats _abilityStats) { // float step = stats.movementSpeed / 2 * Time.deltaTime; // Do Dodge. // go through defence system // healthPoints -= DefenceCheck(_abilityStats); }
public void select() { target = enemies[index]; selectionActive = false; renderer.enabled = false; //trigger chosen action on target //show action marker BattleLogic logic = (BattleLogic)GameObject.Find("Main Camera").GetComponent("BattleLogic"); EnemyStats enemy = (EnemyStats)enemies [index].GetComponent("EnemyStats"); if (logic.isAbilityAttack) { AbilityMarkerArrow ability = GameObject.Find("abilityArrowMarker").GetComponent <AbilityMarkerArrow>(); AbilityStats stats = ability.getSelectedAbility(); enemy.health -= stats.damage; logic.isAbilityAttack = false; } else { enemy.health -= Random.Range(logic.activePlayer.damage / 2, logic.activePlayer.damage); Globals.Play(Resources.Load <AudioClip>("sounds/music/Combat03_Attack hit2")); } Debug.Log("Player " + logic.activePlayer.index + " attacked enemy " + index); }
//ability calculations private static Ability GetAttackStats(Ability a, GroupCombatStats gcs, int attackDesignation) { using (var db = new MinionWarsEntities()) { AbilityStats ast = db.AbilityStats.Find(attackDesignation); a.name = ast.name; a.power = ast.power; a.cooldown = 0; // ast.cooldown; a.remainingCooldown = 0; // ast.cooldown; int powerModifier = 0; if (attackDesignation == 1) { powerModifier = gcs.strength; } else { powerModifier = gcs.dexterity; } a.power += powerModifier; return(a); } }
public Projectile(Player owner, long count, AbilityStats stats, Combatant target, Vector2D position) { this.Owner = owner; this.Count = count; this.Stats = stats; this.Target = target; this.Position = position; }
protected void ApplyVisualEffect(Player player, PlayerEffect visualEffect, AbilityStats stats) { if (visualEffect == PlayerEffect.None) { return; } player.ActivateBuffUI(visualEffect, stats.duration); }
public void SetTimers(AbilityNames _AbilityName, Timer _timer, int _countDownInterval = 1) { GameObject _abilityObject = getAbilityObject(_AbilityName); AbilityStats _abilityStats = null; _abilityStats = _abilityObject.GetComponent <AbilityStats>(); _timer.timerCountMax = _abilityStats.coolingDownTime; _timer.timerCountInterval = _countDownInterval; }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) { player.PullToLocation(transform.position, stats.dotValue, stats.hpValue, casterID); base.ApplyLocalVisualEffects(player, visualEffect); } }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) { player.Knockout(stats.dotValue, stats.hpValue, casterID); base.ApplyLocalVisualEffects(player, visualEffect); } }
// Use this for initialization void Start() { playerCtrl = GameObject.Find("Player").GetComponent <PlayerController>(); thisRigidbody = GetComponent <Rigidbody2D>(); travelingLeft = playerCtrl.facingLeft; stats = gameObject.GetComponent <AbilityStats>(); audioManager = GameObject.Find("Player").GetComponent <PlayerAudioManager>(); damageLowerBound = stats.damageLowerBound; damageUpperBound = stats.damageUpperBound; }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) //if (PhotonNetwork.IsMasterClient) { player.Damage(stats.hpValue, casterID); base.ApplyVisualEffect(player, visualEffect, stats); } }
public void swap() { abilityPanel.sprite = itemToBePickedUpStats.abilityIcon; // Drop current item if (abilitySlot.ability) { GameObject instance = Instantiate(abilitySlot.ability.GetComponent <AbilityStats>().abilityItem, player.transform.position, Quaternion.identity) as GameObject; AbilityStats instanceStats = instance.GetComponent <AbilityStats>(); instanceStats.newItem = false; AbilityStats statsToDrop = abilitySlot.gameObject.GetComponent <AbilityStats>(); instanceStats.newItem = false; instanceStats.abilityName = statsToDrop.abilityName; instanceStats.damageLowerBound = statsToDrop.damageLowerBound; instanceStats.damageUpperBound = statsToDrop.damageUpperBound; instanceStats.manaCost = statsToDrop.manaCost; instanceStats.coolDown = statsToDrop.coolDown; instanceStats.specialEffectName = statsToDrop.specialEffectName; instanceStats.specialEffectDamage = statsToDrop.specialEffectDamage; instanceStats.specialEffectDuration = statsToDrop.specialEffectDuration; instanceStats.specialEffectRepeat = statsToDrop.specialEffectRepeat; instanceStats.abilityIcon = statsToDrop.abilityIcon; instanceStats.abilityItem = statsToDrop.abilityItem; instanceStats.rarity = statsToDrop.rarity; } audioManager.pickupAudio(); // pickup new item abilitySlot.ability = ability; AbilityStats instanceStats2 = abilitySlot.gameObject.GetComponent <AbilityStats>(); instanceStats2.newItem = false; instanceStats2.abilityName = stats.abilityName; instanceStats2.damageLowerBound = stats.damageLowerBound; instanceStats2.damageUpperBound = stats.damageUpperBound; instanceStats2.manaCost = stats.manaCost; instanceStats2.coolDown = stats.coolDown; instanceStats2.specialEffectName = stats.specialEffectName; instanceStats2.specialEffectDamage = stats.specialEffectDamage; instanceStats2.specialEffectDuration = stats.specialEffectDuration; instanceStats2.specialEffectRepeat = stats.specialEffectRepeat; instanceStats2.abilityIcon = stats.abilityIcon; instanceStats2.abilityItem = stats.abilityItem; instanceStats2.rarity = stats.rarity; abilitySlot.resetStats(); player.GetComponent <PlayerController>().enabled = true; // Enable movement and attacking Destroy(item); Destroy(abilityMenu); }
// Use this for initialization void Start() { scripts = GameObject.Find("Player").GetComponentsInChildren <AbilityStats>(); if (abilitySlot != 2 && scripts[abilitySlot]) { if (scripts[abilitySlot].gameObject.GetComponent <UseAbility>().ability) { foreground.gameObject.SetActive(false); stats = scripts[abilitySlot]; Debug.Log("slot" + abilitySlot + " Name:" + stats.abilityName + stats); abilityNameTxt.text = stats.abilityName; damageTxt.text = stats.damageLowerBound + " - " + stats.damageUpperBound; manaTxt.text = "" + stats.manaCost; coolDownTxt.text = "" + stats.coolDown; specialEffectTxt.text = stats.specialEffectName; specialEffectDamageTxt.text = "" + stats.specialEffectDamage; specialEffectDurationTxt.text = "" + stats.specialEffectDuration; specialEffectRepeatTxt.text = "" + stats.specialEffectRepeat; switch (stats.rarity) { case 1: rarityTxt.text = "Common"; rarityTxt.color = Color.gray; break; case 2: rarityTxt.text = "Uncommon"; rarityTxt.color = Color.green; break; case 3: rarityTxt.text = "Rare"; rarityTxt.color = Color.cyan; break; case 4: rarityTxt.text = "Epic"; rarityTxt.color = Color.magenta; break; case 5: rarityTxt.text = "legendary"; rarityTxt.color = Color.yellow; break; } icon.sprite = stats.abilityIcon; } } }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { Debug.Log("DOTEffect ApplyEffect"); base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) { player.DamageAndDOT(stats.hpValue, stats.duration, stats.dotValue, casterID); base.ApplyLocalVisualEffects(player, visualEffect); } }
// Use this for initialization void Start() { levelManager = GameObject.Find("Manager").GetComponent <LevelManager>(); damageLowerBound = (int)(damageLowerBound * (levelManager.floorNumber)); damageUpperBound = (int)(damageUpperBound * (levelManager.floorNumber)); playerCtrl = GameObject.Find("Player").GetComponent <PlayerController>(); thisRigidbody = GetComponent <Rigidbody2D>(); travelingLeft = playerCtrl.facingLeft; stats = gameObject.GetComponent <AbilityStats>(); spellTimer = spellDuration; audioManager = GameObject.Find("Player").GetComponent <PlayerAudioManager>(); }
public void ResetAbilitySlot() { int lengthOfPlayerAbilties = 0; lengthOfPlayerAbilties = playerAbilityHandler.myAbilityNames.Count; // Procedrual codeing; for (int i = 0; i < abilityPanel.transform.childCount; i++) { if (abilityPanel.transform.GetChild(i).name == "Slot" + i) { playerAbilitySlots.Add(abilityPanel.transform.GetChild(i).gameObject); } } for (int i = 0; i < playerAbilitySlots.Count; i++) { AbilityStats playerAbilityStats = null; GameObject activeImageGameObject = null; Image activeImageObjectImageScript = null; Sprite activeImageSprite = null; // This variable is the same as slotNumberSprite; Image slotNumberImageScript = null; Sprite slotNumberSprite = null; //AbilityHandler -> FindAbilityName[0] -> AbilityGameObject -> AbilityStats -> AbilityStats.Icon; // This gets the first child object in each slot. // there is only ever going to be one object in each slot activeImageGameObject = playerAbilitySlots[i].transform.GetChild(0).gameObject; activeImageObjectImageScript = activeImageGameObject.GetComponent <Image>(); slotNumberImageScript = playerAbilitySlots[i].GetComponent <Image>(); if (i == playerAbilityHandler.myAbilityNames.Count) { break; } else if (i <= playerAbilityHandler.myAbilityNames.Count) { playerAbilityStats = getAbilityObject(playerAbilityHandler.myAbilityNames[i]).GetComponent <AbilityStats>(); slotNumberSprite = playerAbilityStats.myIcon; activeImageSprite = slotNumberSprite; slotNumberImageScript.sprite = slotNumberSprite; activeImageObjectImageScript.sprite = activeImageSprite; } } }
public void startCasting(AbilityNames _abilityName) { // THIS FUNCTION DOES NOT INSTANTIATE ANY GAMEOBJECT. abilityCastingTimerOverlay.SetActive(true); // Lets player have a visual on its casting time. GameObject _abilityObject = getAbilityObject(_abilityName); // gets the ability object/ AbilityStats currentAbilityStat = _abilityObject.GetComponent <AbilityStats>(); fillImage = abilityCastingTimerOverlay.transform.GetChild(0).GetComponent <Image>(); // fill image is in the order of the child number indicated in code. abilityNameTxt = abilityCastingTimerOverlay.transform.GetChild(1).GetComponent <Text>(); abilityCastingTime = currentAbilityStat.castingTime; // Sets the fillImage.fillAmount = 0; abilityNameTxt.text = _abilityName.ToString(); }
private static Ability GetAbilityStats(Ability a, GroupCombatStats gcs, int attackDesignation) { using (var db = new MinionWarsEntities()) { AbilityStats ast = db.AbilityStats.Find(attackDesignation); a.name = ast.name; a.power = ast.power; a.cooldown = ast.cooldown; a.duration = ast.duration; a.power += gcs.power; a.cooldown += gcs.cooldown; a.duration += gcs.duration; a.remainingCooldown = a.cooldown; return(a); } }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { Debug.Log("SlowEffect"); base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) { if (applyDamage) { player.SlowForDuration(stats.dotValue, stats.duration); player.Damage(stats.hpValue, casterID); } else { player.SlowForDuration(stats.dotValue, stats.duration); } base.ApplyLocalVisualEffects(player, visualEffect); } }
// Use this for initialization void Start() { itemToBePickedUpStats = ability.GetComponent <AbilityStats>(); if (gameObject.name == "LMBAbilityButton") { abilitySlot = GameObject.FindGameObjectWithTag("LMBAbilitySlot").GetComponent <UseAbility>(); stats = item.GetComponent <AbilityStats>(); abilityPanel = GameObject.FindGameObjectWithTag("LMBSprite").GetComponent <Image>(); } else if (gameObject.name == "RMBAbilityButton") { abilitySlot = GameObject.FindGameObjectWithTag("RMBAbilitySlot").GetComponent <UseAbility>(); stats = item.GetComponent <AbilityStats>(); abilityPanel = GameObject.FindGameObjectWithTag("RMBSprite").GetComponent <Image>(); } player = GameObject.Find("Player"); audioManager = player.GetComponent <PlayerAudioManager>(); }
// Use this for initialization void Start() { playerCtrl = GameObject.Find("Player").GetComponent <PlayerController>(); thisRigidbody = GetComponent <Rigidbody2D>(); travelingLeft = playerCtrl.facingLeft; stats = gameObject.GetComponent <AbilityStats>(); if (travelingLeft) { thisRigidbody.AddForce(new Vector2(-speed, speed / 2)); } else { thisRigidbody.AddForce(new Vector2(speed, speed / 2)); } damageLowerBound = stats.damageLowerBound; damageUpperBound = stats.damageUpperBound; audioManager = GameObject.Find("Player").GetComponent <PlayerAudioManager>(); }
void shoot() { // Reset the timer. timer = 0f; if (ability) { audioManager.spellCastAudio(); anim.SetTrigger("Cast"); GameObject abilityInstance = Instantiate(ability, transform.position, transform.rotation) as GameObject; AbilityStats instanceStats = abilityInstance.GetComponent <AbilityStats>(); AbilityStats stats = gameObject.GetComponent <AbilityStats>(); instanceStats.newItem = stats.newItem; instanceStats.abilityName = stats.abilityName; instanceStats.damageLowerBound = stats.damageLowerBound; instanceStats.damageUpperBound = stats.damageUpperBound; instanceStats.manaCost = stats.manaCost; instanceStats.coolDown = stats.coolDown; instanceStats.specialEffectName = stats.specialEffectName; instanceStats.specialEffectDamage = stats.specialEffectDamage; instanceStats.specialEffectDuration = stats.specialEffectDuration; instanceStats.specialEffectRepeat = stats.specialEffectRepeat; instanceStats.abilityIcon = stats.abilityIcon; instanceStats.abilityItem = stats.abilityItem; playerHealth.reduceMana(manaCost); if (playerCtrl.facingLeft) { Vector3 scale = abilityInstance.transform.localScale; scale.x *= -1; abilityInstance.transform.localScale = scale; } } }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { base.ApplyVisualEffect(player, visualEffect, stats); if (player.isNetworkActive) { Debug.Log("Applying root effect"); if (stats == null) { Debug.Log("RootEffect stats are null wtf?"); } if (player.interactionManager == null) { Debug.Log("RootEffect interactionManager is null wtf?"); } if (player.isNetworkActive) { player.interactionManager.RootPlayer(stats.duration); } base.ApplyLocalVisualEffects(player, visualEffect); } }
public Ab_BombDrop(PlayerController _pc) : base(_pc) { stats = new AbilityStats(this, Abilities.Bomb, UpdateType.Update, 5f, 35f); }
public override void ApplyEffect(Player player, AbilityStats stats, int casterID) { base.ApplyLocalVisualEffects(player, visualEffect); player.HealOverTime(stats.duration, stats.hpValue); PlayerManager.Instance.ActivatePlayerUIBuff(visualEffect, stats.duration, player.GetID(), Photon.Pun.RpcTarget.All); }
internal AbilityInfo(AbilityStats data, int index, double quantity) { this.Data = data; this.Index = index; this.Quantity = quantity; }
public Ab_MachineGun(PlayerController _pc) : base(_pc) { stats = new AbilityStats(this, Abilities.Turrets, UpdateType.FixedUpdate, .1f, 5f); }
public Ab_Rewind(PlayerController _pc) : base(_pc) { stats = new AbilityStats(this, Abilities.Rewind, UpdateType.FixedUpdate, COOLDOWN, ENERGY_COST); }
public abstract void ApplyEffect(Player player, AbilityStats stats, int casterID);
public Ab_SpawnTurret(PlayerController _pc) : base(_pc) { stats = new AbilityStats(this, Abilities.Turrets, UpdateType.Update, .2f, 30f); }