Example #1
0
        public override Condition SetupCondition(int p_seed, int p_level)
        {
            base.SetupCondition(p_seed, p_level);

            Dictionary <string, string> ItemIDNameDict = new Dictionary <string, string>();

            if (SkillHandler.IsSkillUnlocked("Blood Sword"))
            {
                ItemIDNameDict.Add("BloodSword", "Blood Sword");
            }

            if (SkillHandler.IsSkillUnlocked("Blood Bow"))
            {
                ItemIDNameDict.Add("BloodArrow", "Blood Bow");
            }

            ItemIDNameDict.Add("BloodDagger", "Blood Dagger");
            ItemIDNameDict.Add("BloodBullet", "Blood Bullet");


            chosenItemKey = ItemIDNameDict.ToList()[random.Next(0, ItemIDNameDict.Count)].Key;


            conditionText = $"using a {ItemIDNameDict[chosenItemKey]}";

            return(this);
        }
Example #2
0
        public override void UpdateCaster()
        {
            base.UpdateCaster();

            if (spellCaster.ragdollHand.side == Side.Left)
            {
                BloodDrain.drainEffectLeft.SetVector3("AttractiveTargetPosition", spellCaster.magic.position);
            }
            else
            {
                BloodDrain.drainEffectRight.SetVector3("AttractiveTargetPosition", spellCaster.magic.position);
            }


            //Check for passive healing
            if (SkillHandler.IsSkillUnlocked("Healing"))
            {
                if (Time.time - lastDamageTime > 5)
                {
                    Creature spellcastCreature = spellCaster.ragdollHand.creature;
                    //Not been damaged for 5 seconds
                    if (spellcastCreature.currentHealth < spellcastCreature.maxHealth)
                    {
                        spellcastCreature.Heal(BookUIHandler.saveData.drainPower * 0.2f * Time.deltaTime, spellcastCreature);
                    }
                }
            }

            //check for choking

            if (SkillHandler.IsSkillUnlocked("Choke Drain"))
            {
                //Debug.Log("Choke unlocked");
                Handle grabbedHandle = spellCaster.ragdollHand.grabbedHandle;
                if (grabbedHandle is HandleRagdoll)
                {
                    //Debug.Log("Handle is handle ragdoll");
                    //Grabbed handle is a neck of a creature
                    if (PlayerControl.GetHand(spellCaster.ragdollHand.side).useAxis > 0)
                    {
                        //Player is pressing the use button
                        Creature grabbedCreature = (grabbedHandle as HandleRagdoll).ragdollPart.ragdoll.creature;
                        if (!grabbedCreature.isKilled)
                        {
                            //Creature not killed
                            float             health            = BookUIHandler.saveData.drainPower * Time.deltaTime * 2;
                            CollisionInstance collisionInstance = new CollisionInstance(new DamageStruct(DamageType.Energy, health));
                            grabbedCreature.Damage(collisionInstance);

                            lastDamageTime = Time.time;
                            BloodDrain.DrainHealth(health, this, grabbedCreature);
                        }
                    }
                }
            }


            if (currentCharge > 0.8f)
            {
                //Check for draining
                if (BloodDrain.TryToActivate(this, Vector3.zero, BookUIHandler.saveData))
                {
                    if (spellCaster.ragdollHand.side == Side.Left)
                    {
                        BloodDrain.drainEffectLeft.Play();
                    }
                    else
                    {
                        BloodDrain.drainEffectRight.Play();
                    }
                }
                else
                {
                    if (spellCaster.ragdollHand.side == Side.Left)
                    {
                        BloodDrain.drainEffectLeft.Stop();
                    }
                    else
                    {
                        BloodDrain.drainEffectRight.Stop();
                    }
                }

                if (!swordSpawned && SkillHandler.IsSkillUnlocked("Blood Sword"))
                {
                    if (BloodSword.TryToActivate(this, Vector3.zero, BookUIHandler.saveData))
                    {
                        spellCaster.StartCoroutine(SpawnSword());
                        lastDamageTime = Time.time;
                    }
                }

                if (!bowSpawned && SkillHandler.IsSkillUnlocked("Blood Bow"))
                {
                    if (BloodBow.TryToActivate(this, Vector3.zero, BookUIHandler.saveData))
                    {
                        spellCaster.StartCoroutine(SpawnBow());
                        lastDamageTime = Time.time;
                    }
                }

                //Check wave
                if (!BloodWave.waveCreated && SkillHandler.IsSkillUnlocked("Blood Wave"))
                {
                    if (BloodWave.TryToActivate(this, Vector3.zero, BookUIHandler.saveData))
                    {
                        spellCaster.StartCoroutine(SpawnBloodWave());
                        lastDamageTime = Time.time;
                    }
                }
            }
            else
            {
                if (spellCaster.ragdollHand.side == Side.Left)
                {
                    BloodDrain.drainEffectLeft.Stop();
                }
                else
                {
                    BloodDrain.drainEffectRight.Stop();
                }
            }
        }