Пример #1
0
        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);
        }
Пример #2
0
 // 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);
 }
Пример #3
0
    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);
    }
Пример #4
0
        //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);
            }
        }
Пример #5
0
 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;
 }
Пример #6
0
    protected void ApplyVisualEffect(Player player, PlayerEffect visualEffect, AbilityStats stats)
    {
        if (visualEffect == PlayerEffect.None)
        {
            return;
        }

        player.ActivateBuffUI(visualEffect, stats.duration);
    }
Пример #7
0
    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;
    }
Пример #8
0
    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);
        }
    }
Пример #9
0
    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);
        }
    }
Пример #10
0
    // 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;
    }
Пример #11
0
    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);
        }
    }
Пример #12
0
    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);
    }
Пример #13
0
    // 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;
            }
        }
    }
Пример #14
0
    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);
        }
    }
Пример #15
0
    // 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>();
    }
Пример #16
0
    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;
            }
        }
    }
Пример #17
0
    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();
    }
Пример #18
0
        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);
            }
        }
Пример #19
0
    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);
        }
    }
Пример #20
0
    // 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>();
    }
Пример #21
0
    // 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>();
    }
Пример #22
0
    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;
            }
        }
    }
Пример #23
0
    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);
        }
    }
Пример #24
0
 public Ab_BombDrop(PlayerController _pc) : base(_pc)
 {
     stats = new AbilityStats(this, Abilities.Bomb, UpdateType.Update, 5f, 35f);
 }
Пример #25
0
 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);
 }
Пример #26
0
 internal AbilityInfo(AbilityStats data, int index, double quantity)
 {
     this.Data     = data;
     this.Index    = index;
     this.Quantity = quantity;
 }
Пример #27
0
 public Ab_MachineGun(PlayerController _pc) : base(_pc)
 {
     stats = new AbilityStats(this, Abilities.Turrets, UpdateType.FixedUpdate, .1f, 5f);
 }
Пример #28
0
 public Ab_Rewind(PlayerController _pc) : base(_pc)
 {
     stats = new AbilityStats(this, Abilities.Rewind, UpdateType.FixedUpdate, COOLDOWN, ENERGY_COST);
 }
Пример #29
0
 public abstract void ApplyEffect(Player player, AbilityStats stats, int casterID);
Пример #30
0
 public Ab_SpawnTurret(PlayerController _pc) : base(_pc)
 {
     stats = new AbilityStats(this, Abilities.Turrets, UpdateType.Update, .2f, 30f);
 }