Example #1
0
 public FireData(WeaponDamage d)
 {
     Power              = d.Power;
     Degradation        = d.ArmorDegradation;
     HealthDamageFactor = d.HealthDamageFactor;
     SuffocationDamage  = d.SuffocationDamage;
 }
        private OperationResponse CallTestKill(MmoActor player, OperationRequest request, RPCInvokeOperation op)
        {
            bool success         = false;
            var  targetComponent = player.GetComponent <PlayerTarget>();

            if (targetComponent.targetObject != null)
            {
                var targetDamagableComponent = targetComponent.targetObject.GetComponent <DamagableObject>();
                if (targetDamagableComponent != null)
                {
                    WeaponDamage weaponDamage = new WeaponDamage(WeaponBaseType.Rocket, 100000, 0, 0);
                    DamageParams damageParams = new DamageParams();
                    damageParams.SetReflrected(false);
                    damageParams.SetIgnoreFixedDamage(true);
                    targetDamagableComponent.ReceiveDamage(new InputDamage(player.nebulaObject, weaponDamage, damageParams));
                    success = true;
                }
            }
            RPCInvokeResponse responseInstance = new RPCInvokeResponse {
                rpcId  = op.rpcId,
                result = success
            };

            return(new OperationResponse(request.OperationCode, responseInstance));
        }
Example #3
0
        public WeaponObject(
            string id,
            string template,
            int level,
            //float damage,
            WeaponDamage damage,
            float optimalDistance,
            ObjectColor color,
            WeaponDamageType damageType,
            float inBaseCritChance,
            int workshop)
        {
            this.id       = id;
            this.template = template;
            this.level    = level;
            //this.damage = damage;
            m_Damage.SetFromDamage(damage);
            this.optimalDistance = optimalDistance;
            this.color           = color;
            this.damageType      = damageType;
            this.baseCritChance  = inBaseCritChance;
            this.mWorkshop       = workshop;
            isNew = true;

            mRaw = GetInfo();
        }
Example #4
0
    // Use this for initialization
    void Start()
    {
        base.Start();

        //Одеть оружие за спину
        if (currentWeapon != null)
        {
            currentWeapon.isEquipped = true;
            currentWeapon.transform.SetParent(backT);
            currentWeapon.gameObject.transform.localPosition = currentWeapon.weaponBackPos;
            currentWeapon.gameObject.transform.localRotation = Quaternion.Euler(currentWeapon.weaponBackRot);
            //TakeWeapon();
            WeaponDamage wd = currentWeapon.GetComponent <WeaponDamage>();
            if (wd != null)
            {
                wd.thisPlayerWeapon = false;
                wd.npc = this;
            }
            Collider weaponCollider = currentWeapon.GetComponent <Collider>();
            if (weaponCollider != null)
            {
                weaponCollider.enabled = false;
            }
        }
    }
Example #5
0
 public KineticData(WeaponDamage d)
 {
     Power              = d.Power;
     Degradation        = d.ArmorDegradation;
     HealthDamageFactor = d.HealthDamageFactor;
     Friction           = d.AirFriction;
 }
Example #6
0
 public InputDamage(NebulaObject source, WeaponDamage damage, DamageParams damageParams = null)
 {
     m_Damager = source;
     m_Damage  = damage;
     if (m_Damager)
     {
         var sourceCharacter = source.Character();
         if (sourceCharacter)
         {
             m_Workshop = (Workshop)sourceCharacter.workshop;
             m_Level    = sourceCharacter.level;
         }
         else
         {
             m_Workshop = Workshop.Arlen;
             m_Level    = 1;
         }
         var sourceRaceable = source.Raceable();
         if (sourceRaceable)
         {
             m_Race = (Race)sourceRaceable.race;
         }
         else
         {
             m_Race = Race.None;
         }
     }
     else
     {
         m_Workshop = Workshop.Arlen;
         m_Level    = 1;
         m_Race     = Race.None;
     }
     m_DamageParams = damageParams;
 }
        // Token: 0x06000056 RID: 86 RVA: 0x00003C78 File Offset: 0x00001E78
        public static Skill Init()
        {
            SL_AttackSkill sl_AttackSkill = new SL_AttackSkill
            {
                Name                   = "Horde Breaker",
                EffectBehaviour        = EffectBehaviours.OverrideEffects,
                Target_ItemID          = 8100320,
                New_ItemID             = 2502024,
                SLPackName             = "Juggernaut",
                SubfolderName          = "HordeBreaker",
                Description            = string.Format("Does two attacks in wide archs that stagger on hit.\n\n{0}: Confused enemies are knocked down.\n\n{1}: Enemies in pain are slowed down.", "Unyielding", "Vengeful"),
                CastType               = new Character.SpellCastType?(Character.SpellCastType.WeaponSkill1),
                CastModifier           = new Character.SpellCastModifier?(Character.SpellCastModifier.Attack),
                CastLocomotionEnabled  = false,
                MobileCastMovementMult = -1f,
                CastSheatheRequired    = 2,
                RequiredWeaponTypes    = new Weapon.WeaponType[]
                {
                    Weapon.WeaponType.Axe_1H,
                    Weapon.WeaponType.Axe_2H,
                    Weapon.WeaponType.Sword_1H,
                    Weapon.WeaponType.Sword_2H,
                    Weapon.WeaponType.Mace_1H,
                    Weapon.WeaponType.Mace_2H,
                    Weapon.WeaponType.Halberd_2H,
                    Weapon.WeaponType.Spear_2H
                },
                EffectTransforms = new SL_EffectTransform[]
                {
                    new SL_EffectTransform
                    {
                        TransformName = "Effects",
                        Effects       = new SL_Effect[0],
                    }
                },
                Cooldown    = 60f,
                StaminaCost = 16f,
                ManaCost    = 0f
            };
            Skill skill = (Skill)CustomItems.CreateCustomItem(sl_AttackSkill.Target_ItemID, sl_AttackSkill.New_ItemID, sl_AttackSkill.Name, sl_AttackSkill);

            UnityEngine.Object.Destroy(skill.transform.Find("HitEffects_Rage").gameObject);
            UnityEngine.Object.Destroy(skill.transform.Find("HitEffects_Discipline").gameObject);
            WeaponSkillAnimationSelector.SetCustomAttackAnimation(skill, Weapon.WeaponType.Halberd_2H);
            Transform transform = skill.transform.Find("HitEffects");

            transform.gameObject.AddComponent <HordeBreakerEffect>();
            WeaponDamage componentInChildren = skill.gameObject.GetComponentInChildren <WeaponDamage>();

            componentInChildren.WeaponDamageMult            = 1f;
            componentInChildren.WeaponDurabilityLossPercent = 0f;
            componentInChildren.WeaponDurabilityLoss        = 1f;
            componentInChildren.Damages             = new DamageType[0];
            componentInChildren.WeaponKnockbackMult = 1f;
            UnityEngine.Object.Destroy(skill.gameObject.GetComponentInChildren <HasStatusEffectEffectCondition>());
            UnityEngine.Object.Destroy(skill.gameObject.GetComponentInChildren <AddStatusEffect>());
            return(skill);
        }
Example #8
0
        public override WeaponDamage GetDamage(bool isCritical)
        {
            WeaponDamage result = (isCritical) ? critDamage : damage;

            result.Mult(1.0f + cachedBonuses.damagePcBonus);
            result.AddToBase(cachedBonuses.damageCntBonus);
            result.ClampLess(0f);
            return(result);
        }
Example #9
0
        // Add calculated values to the values dictionary.
        // These values are then available for display via the CharacterDisplayCalculationLabels
        // member defined in CalculationsRetribution.cs
        // While possible, there's little reason to add values to the dictionary that are not being
        // used by the CharacterDisplayCalculationLabels.
        public override Dictionary <string, string> GetCharacterDisplayCalculationValues()
        {
            Dictionary <string, string> dictValues = new Dictionary <string, string>();

            // Status text
            dictValues["Status"] = string.Format("{0} dps", DPSPoints.ToString("N0"));

            // Basic stats
            dictValues["Health"]        = BasicStats.Health.ToString("N0");
            dictValues["Mana"]          = BasicStats.Mana.ToString("N0");
            dictValues["Strength"]      = BasicStats.Strength.ToString("N0");
            dictValues["Agility"]       = string.Format("{0:0}", BasicStats.Agility);
            dictValues["Attack Power"]  = BasicStats.AttackPower.ToString("N0");
            dictValues["Crit Chance"]   = string.Format("{0:P}*{1:0} crit rating", BasicStats.PhysicalCrit, BasicStats.CritRating);
            dictValues["Miss Chance"]   = string.Format("{0:P}*{1:P} hit ({2:0} rating)\n", ToMiss, BasicStats.PhysicalHit, BasicStats.HitRating);
            dictValues["Dodge Chance"]  = string.Format("{0:P}*{1:P} expertise ({2:0} rating)", ToBeDodged, BasicStats.Expertise * .0025f, BasicStats.ExpertiseRating);
            dictValues["Melee Haste"]   = string.Format("{0:P}*{1:0} haste rating", BasicStats.PhysicalHaste, BasicStats.HasteRating);
            dictValues["Weapon Damage"] = WeaponDamage.ToString("N2");
            dictValues["Attack Speed"]  = AttackSpeed.ToString("N2");

            // DPS Breakdown
            dictValues["Total DPS"]         = OverallPoints.ToString("N0");
            dictValues["White"]             = string.Format("{0}*{1}", WhiteDPS.ToString("N0"), WhiteSkill.ToString());
            dictValues["Seal"]              = string.Format("{0}*{1}", SealDPS.ToString("N0"), SealSkill.ToString());
            dictValues["Crusader Strike"]   = string.Format("{0}*{1}", CrusaderStrikeDPS.ToString("N0"), CrusaderStrikeSkill.ToString());
            dictValues["Judgement"]         = string.Format("{0}*{1}", JudgementDPS.ToString("N0"), JudgementSkill.ToString());
            dictValues["Consecration"]      = string.Format("{0}*{1}", ConsecrationDPS.ToString("N0"), ConsecrationSkill.ToString());
            dictValues["Exorcism"]          = string.Format("{0}*{1}", ExorcismDPS.ToString("N0"), ExorcismSkill.ToString());
            dictValues["Divine Storm"]      = string.Format("{0}*{1}", DivineStormDPS.ToString("N0"), DivineStormSkill.ToString());
            dictValues["Hammer of Wrath"]   = string.Format("{0}*{1}", HammerOfWrathDPS.ToString("N0"), HammerOfWrathSkill.ToString());
            dictValues["Hand of Reckoning"] = string.Format("{0}*{1}", HandOfReckoningDPS.ToString("N0"), HandOfReckoningSkill.ToString());
            dictValues["Other"]             = OtherDPS.ToString("N0");

            // Rotation Info:
            dictValues["Chosen Rotation"] = Rotation == null ?
                                            "n/a" :
                                            SimulatorParameters.ShortRotationString(Rotation); // TODO: Remove dependancy on SimulatorParameters.
            dictValues["Average SoV Stack"]  = AverageSoVStack.ToString("N2");
            dictValues["SoV Overtake"]       = string.Format("{0} sec", SoVOvertake.ToString("N2"));
            dictValues["Crusader Strike CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.CrusaderStrike).ToString("N2");
            dictValues["Judgement CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.Judgement).ToString("N2");
            dictValues["Consecration CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.Consecration).ToString("N2");
            dictValues["Exorcism CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.Exorcism).ToString("N2");
            dictValues["Divine Storm CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.DivineStorm).ToString("N2");
            dictValues["Hammer of Wrath CD"] =
                Solution.GetAbilityEffectiveCooldown(Ability.HammerOfWrath).ToString("N2");

            return(dictValues);
        }
Example #10
0
 private WeaponDamage ApplyDamagePassiveBonus(WeaponDamage inputDamage)
 {
     if (nebulaObject.IsPlayer())
     {
         if (mPassiveBonuses != null && mPassiveBonuses.damageBonusTier > 0)
         {
             inputDamage.Mult(1.0f + mPassiveBonuses.damageBonus);
             return(inputDamage);
         }
     }
     return(inputDamage);
 }
        public static void Postfix(WeaponDamage __instance, Character _targetCharacter)
        {
            if (_targetCharacter.Alive || Time.time - _targetCharacter.TimeOfDeath < 1f)
            {
                var damages = __instance.m_tempList.Clone();
                var weapon  = __instance.m_weapon;

                _targetCharacter.ProcessDamageReduction(weapon, damages, false);

                DamageLabels.AddDamageLabel(damages, _targetCharacter.CenterPosition, _targetCharacter);
            }
        }
 public override void GetProperties(ObjectPropertyList list)
 {
     base.GetProperties(list);
     if (RequiredLevel > 0)
     {
         list.Add(1060658, "Required Level\t{0}", RequiredLevel.ToString());
     }
     if (WeaponDamage > 0)
     {
         list.Add(1060659, "Weapon Damage\t{0}", WeaponDamage.ToString());
     }
 }
Example #13
0
        public static void Prefix(WeaponDamage __instance, ref AttackSkill ___m_attackSkill, out List <Weapon.WeaponType> __state)
        {
            __state = null;
            AttackSkill attackSkill = ___m_attackSkill;
            Weapon      weapon;

            if (attackSkill == null)
            {
                weapon = null;
            }
            else
            {
                Character ownerCharacter = attackSkill.OwnerCharacter;
                weapon = ((ownerCharacter != null) ? ownerCharacter.CurrentWeapon : null);
            }
            Weapon weapon2 = weapon;
            bool   flag    = weapon2 != null;

            if (flag)
            {
                Weapon.WeaponType valueOrDefault;
                bool flag2;
                if (___m_attackSkill.RequiredWeaponTypes != null)
                {
                    Weapon.WeaponType?bastardType = BehaviourManager.GetBastardType(weapon2.Type);
                    if (bastardType != null)
                    {
                        valueOrDefault = bastardType.GetValueOrDefault();
                        flag2          = true;
                    }
                    else
                    {
                        flag2 = false;
                    }
                }
                else
                {
                    flag2 = false;
                }
                bool flag3 = flag2;
                if (flag3)
                {
                    bool flag4 = ___m_attackSkill.RequiredWeaponTypes.Contains(valueOrDefault) && !___m_attackSkill.RequiredWeaponTypes.Contains(weapon2.Type) && BehaviourManager.IsBastardMode(weapon2);
                    if (flag4)
                    {
                        __state = ___m_attackSkill.RequiredWeaponTypes;
                        ___m_attackSkill.RequiredWeaponTypes = new List <Weapon.WeaponType>(__state);
                        ___m_attackSkill.RequiredWeaponTypes.Add(weapon2.Type);
                    }
                }
            }
        }
Example #14
0
        //private WeaponBaseType myWeaponBaseType {
        //    get {
        //        if(m_Race != null ) {
        //            return CommonUtils.Race2WeaponBaseType((Race)m_Race.race);
        //        }
        //        return WeaponBaseType.Rocket;
        //    }
        //}

        public override WeaponDamage GetDamage(bool isCrit)
        {
            if (m_Pet)
            {
                if (m_Pet.info != null)
                {
                    WeaponDamage dmg = new WeaponDamage(myWeaponBaseType);
                    dmg.SetBaseTypeDamage(m_Pet.info.Damage(nebulaObject.resource.petParameters.damage, nebulaObject.resource.Leveling));
                    return(dmg);
                }
            }
            return(new WeaponDamage(myWeaponBaseType));
        }
        // Token: 0x0600001F RID: 31 RVA: 0x00002A30 File Offset: 0x00000C30
        public static WeaponDamage AddWeaponDamage(ImbueEffectPreset effect, float baseDamage, float damageScaling, DamageType.Types damageType)
        {
            WeaponDamage weaponDamage = effect.transform.Find("Effects").gameObject.AddComponent <WeaponDamage>();

            weaponDamage.WeaponDamageMult = 1f + damageScaling;
            weaponDamage.OverrideDType    = damageType;
            weaponDamage.Damages          = new DamageType[]
            {
                new DamageType(damageType, baseDamage)
            };
            weaponDamage.OverrideEffectCategory = EffectSynchronizer.EffectCategories.Hit;
            return(weaponDamage);
        }
Example #16
0
 public override string ToString()
 {
     return(string.Format("{0} ({1}{2}DMG: {3}{4}, {5}x on Crit{6}){7}",
                          this.Name,
                          (FiringType != string.Empty ? string.Format("{0} ", FiringType) : string.Empty),
                          (Range > 0d ? string.Format("Rng: {0} ", Range.ToString()) : string.Empty),
                          WeaponDamage.ToString(),
                          (DamageType != string.Empty ? string.Format(" - ({0})", DamageType) : string.Empty),
                          CritMultiplier.ToString(),
                          ReloadTime > 0 ? (currentReload > 0 ? string.Format(", Reloading: {0}/{1}", currentReload, ReloadTime) : string.Format(", {0} Reload", ReloadTime.ToString())) : "",
                          IsDestroyed ? " [DESTROYED!]" : ""
                          ));
 }
Example #17
0
    IEnumerator Attack()
    {
        aSourceWeapon = Managers.player.currentWeapon.gameObject.GetComponent <AudioSource>();
        Collider     weaponCollider = Managers.player.currentWeapon.GetComponent <Collider>();
        WeaponDamage wd             = Managers.player.currentWeapon.GetComponent <WeaponDamage>();

        attack = true;
        Managers.player.moveBlock = true;

        //Managers.player.myAnimator.SetFloat("speed", 0);
        Managers.player.myAnimator.SetTrigger("AttackRight");

        yield return(new WaitForSeconds(0.42f));



        //Начало нанесения урона
        if (weaponCollider != null)
        {
            weaponCollider.enabled = true;
        }

        startDamage = true;

        //yield return new WaitForSeconds(0.1f);
        if (!aSourceWeapon.isPlaying)
        {
            aSourceWeapon.Play();                          //Звук удара
        }
        yield return(new WaitForSeconds(0.35f));

        //Конец нанесения урона
        if (weaponCollider != null)
        {
            weaponCollider.enabled = false;
        }
        startDamage = false;


        yield return(new WaitForSeconds(0.37f));

        //Завершение анимации

        if (wd != null)
        {
            wd.ClearDamageList();
        }
        attack = false;
        Managers.player.moveBlock = false;
    }
Example #18
0
    void Awake()
    {
        UnitManager.Instance.Add(this);
        // gimme a health bar!
        HealthBar.NewHealthBar(transform);
        attackInfo = new AttackInfo();
        WeaponDamage wd = new WeaponDamage();

        wd.BaseDamage     = 1;
        wd.DexScale       = 0.5f;
        wd.IntScale       = 0.25f;
        wd.StrScale       = 0.75f;
        attackInfo.Effect = wd;
    }
Example #19
0
 public void Update(float deltaTime)
 {
     if (active)
     {
         WeaponDamage dmgPerSec = new WeaponDamage(m_TimedDamageType);
         dmgPerSec.SetBaseTypeDamage(damagePerSecond * deltaTime);
         InputDamage inpDamage = new InputDamage(null, dmgPerSec);
         mTarget.ReceiveDamage(inpDamage);
         mTimer -= deltaTime;
         if (mTimer <= 0f)
         {
             active = false;
         }
     }
 }
    public void BuyWeapon(int cost)
    {
        if (cost > PM.playerCurrency)
        {
            GM.notEnough.SetActive(true);
            StartCoroutine(DeactivateNE());
            Debug.Log("not enough currency"); //make text say it!! coroutine to remove
        }

        else
        {
            PM.playerCurrency -= cost;
            if (cost == 6)
            {
                WeaponDamage WD = d6.GetComponent <WeaponDamage>();
                WD.uses += 2;
                if (WD.uses > 0)
                {
                    d6.SetActive(true);
                }
                Debug.Log(cost + " has " + WD.uses + " uses");
            }

            if (cost == 8)
            {
                WeaponDamage WD = d8.GetComponent <WeaponDamage>();
                WD.uses += 2;
                if (WD.uses > 0)
                {
                    d8.SetActive(true);
                }
                Debug.Log(cost + " has " + WD.uses + " uses");
            }

            if (cost == 10)
            {
                WeaponDamage WD = d10.GetComponent <WeaponDamage>();
                WD.uses += 2;
                if (WD.uses > 0)
                {
                    d10.SetActive(true);
                }
                Debug.Log(cost + " has " + WD.uses + " uses");
            }
        }
    }
        // Token: 0x0600000F RID: 15 RVA: 0x00002850 File Offset: 0x00000A50
        public static Skill Init()
        {
            SL_AttackSkill sl_AttackSkill = new SL_AttackSkill
            {
                Name                   = "Retributive Smite",
                EffectBehaviour        = EffectBehaviours.NONE,
                Target_ItemID          = 8100260,
                New_ItemID             = 2502006,
                SLPackName             = "Templar",
                SubfolderName          = "Retributive Smite",
                Description            = "Completely block a physical attack, striking the attacker and dealing additional lightning damage.",
                CastType               = Character.SpellCastType.Counter,
                CastModifier           = Character.SpellCastModifier.Attack,
                CastLocomotionEnabled  = false,
                MobileCastMovementMult = -1f,
                CastSheatheRequired    = 2,
                RequiredWeaponTypes    = new Weapon.WeaponType[]
                {
                    Weapon.WeaponType.Axe_1H,
                    Weapon.WeaponType.Axe_2H,
                    Weapon.WeaponType.Sword_1H,
                    Weapon.WeaponType.Sword_2H,
                    Weapon.WeaponType.Mace_1H,
                    Weapon.WeaponType.Mace_2H,
                    Weapon.WeaponType.Halberd_2H,
                    Weapon.WeaponType.Spear_2H
                },
                Cooldown    = 40f,
                StaminaCost = 8f,
                ManaCost    = 7f,
            };
            Skill        skill = (Skill)CustomItems.CreateCustomItem(sl_AttackSkill.Target_ItemID, sl_AttackSkill.New_ItemID, sl_AttackSkill.Name, sl_AttackSkill);
            WeaponDamage componentInChildren = skill.gameObject.GetComponentInChildren <WeaponDamage>();

            componentInChildren.WeaponDamageMult            = 1.5f;
            componentInChildren.WeaponDamageMultKDown       = -1f;
            componentInChildren.WeaponDurabilityLossPercent = 0f;
            componentInChildren.WeaponDurabilityLoss        = 1f;
            componentInChildren.OverrideDType = DamageType.Types.Count;
            componentInChildren.Damages       = new DamageType[]
            {
                new DamageType(DamageType.Types.Electric, 20f)
            };
            return(skill);
        }
Example #22
0
        private void ApplyDamage(ref WeaponHitInfo hit, DamagableObject target, float damageMult, bool useDamageMultSelfAsDamage, InputDamage inputDamage)
        {
            inputDamage.Mult(damageMult * Rand.NormalNumber(0.8f, 1.2f));

            if (useDamageMultSelfAsDamage)
            {
                WeaponDamage dmg = new WeaponDamage(inputDamage.weaponBaseType, 0, 0, 0);
                dmg.SetBaseTypeDamage(damageMult);
                inputDamage.CopyValues(dmg);
            }

            if (cachedSkills)
            {
                cachedSkills.ModifyDamage(target, inputDamage);
            }

            int  level    = 1;
            byte workshop = (byte)Workshop.Arlen;
            byte race     = (byte)Race.None;

            level    = cachedCharacter.level;
            workshop = cachedCharacter.workshop;

            RaceableObject raceable = nebulaObject.Raceable();

            if (raceable)
            {
                race = raceable.race;
            }

            var copy = inputDamage.CreateCopy();

            if (false == ReflectDamage(target, ref hit, inputDamage))
            {
                target.ReceiveDamage(inputDamage);
                StartDamageDron(target, inputDamage.CreateCopy(), workshop, level, race);
            }
            hit.SetRemainTargetHp(target.health);

            if (m_Achievments != null)
            {
                m_Achievments.OnMakeDamage(copy);
            }
        }
Example #23
0
    public string GetDesc(Weapon w)
    {
        WeaponDamage wd = w.attackInfo.Effect as WeaponDamage;

        string s = "Base Damage: " + wd.BaseDamage;

        if (wd.StrScale > 0)
        {
            s += "\n +" + Mathf.RoundToInt(wd.StrScale * 100) + "% STR";
        }
        if (wd.DexScale > 0)
        {
            s += "\n +" + Mathf.RoundToInt(wd.DexScale * 100) + "% DEX";
        }
        if (wd.IntScale > 0)
        {
            s += "\n +" + Mathf.RoundToInt(wd.IntScale * 100) + "% INT";
        }
        s += "\nTotal damage: " + wd.GetDamage(client.Owner.ModifiedStats);
        if (wd.DefenceMulitiplier == 1f && wd.ResistanceMultiplier == 0f)
        {
            s += "\n vs Defence.";
        }
        else if (wd.DefenceMulitiplier == 0f && wd.ResistanceMultiplier == 1f)
        {
            s += "\n vs Resistance.";
        }
        else if (wd.DefenceMulitiplier > 0f && wd.ResistanceMultiplier == 0f)
        {
            s += "\n vs " + GUIUtility.FloatToPercent(wd.DefenceMulitiplier) + " Defence.";
        }
        else if (wd.DefenceMulitiplier == 0f && wd.ResistanceMultiplier > 0f)
        {
            s += "\n vs " + GUIUtility.FloatToPercent(wd.ResistanceMultiplier) + " Resistance.";
        }
        else
        {
            s += "\n vs " + GUIUtility.FloatToPercent(wd.DefenceMulitiplier) + " Defence & " + GUIUtility.FloatToPercent(wd.ResistanceMultiplier) + " Resistance.";
        }


        s += "\n" + GUIUtility.StatsToString(w.buff);
        return(s);
    }
Example #24
0
    IEnumerator AttackState()
    {
        AudioSource  aSrcWeapon     = thisNPC.currentWeapon.gameObject.GetComponent <AudioSource>();
        Collider     weaponCollider = thisNPC.currentWeapon.GetComponent <Collider>();
        WeaponDamage wd             = thisNPC.currentWeapon.GetComponent <WeaponDamage>();

        if (thisAnimator.GetFloat("speed") > 0)
        {
            thisAnimator.SetFloat("speed", 0.0f);
        }
        thisAgent.isStopped = true;
        yield return(new WaitForSeconds(0.1f));

        thisAnimator.SetTrigger("Attack");
        yield return(new WaitForSeconds(0.25f));

        //Начало нанесения урона
        if (weaponCollider != null)
        {
            weaponCollider.enabled = true;
        }
        if (!aSrcWeapon.isPlaying)
        {
            aSrcWeapon.Play();                       //Звук удара
        }
        yield return(new WaitForSeconds(0.3f));

        //Конец нанесения урона
        if (weaponCollider != null)
        {
            weaponCollider.enabled = false;
        }

        if (wd != null)
        {
            wd.ClearDamageList();
        }

        yield return(new WaitForSeconds(0.25f));

        StartCoroutine(BattleModeState());
    }
Example #25
0
 private void ApplyReflection(InputDamage inputDamage)
 {
     if ((false == inputDamage.reflected) && inputDamage.hasDamager)
     {
         var reflectValue = mBonuses.reflectionPc;
         if (false == Mathf.Approximately(reflectValue, 0f))
         {
             float        reflectedDamageVal = inputDamage.totalDamage * reflectValue;
             var          attackerDamagable  = inputDamage.source.Damagable();
             WeaponDamage reflectedDamage    = new WeaponDamage(inputDamage.weaponBaseType);
             reflectedDamage.SetBaseTypeDamage(reflectedDamageVal);
             if (attackerDamagable)
             {
                 DamageParams damageParams = new DamageParams();
                 damageParams.SetReflrected(true);
                 attackerDamagable.ReceiveDamage(new InputDamage(nebulaObject, reflectedDamage, damageParams));
             }
         }
     }
 }
Example #26
0
    // Use this for initialization
    void Start()
    {
        base.Start();

        if (currentWeapon != null)
        {
            currentWeapon.isEquipped = true;
            //TakeWeapon();
            WeaponDamage wd = currentWeapon.GetComponent <WeaponDamage>();
            if (wd != null)
            {
                wd.thisPlayerWeapon = false;
                wd.npc = this;
            }
            Collider weaponCollider = currentWeapon.GetComponent <Collider>();
            if (weaponCollider != null)
            {
                weaponCollider.enabled = false;
            }
        }
    }
Example #27
0
        private void StartDamageDron(DamagableObject targetObject, WeaponDamage inputDamage, byte workshop, int level, byte race)
        {
            if (nebulaObject.IsPlayer())
            {
                if (mPassiveBonuses != null && mPassiveBonuses.damageDronTier > 0)
                {
                    WeaponDamage dronDamage = new WeaponDamage();
                    dronDamage.SetFromDamage(inputDamage);
                    dronDamage.Mult(mPassiveBonuses.damageDronBonus);

                    InputDamage inpDamage = new InputDamage(nebulaObject, dronDamage);
                    targetObject.ReceiveDamage(inpDamage);

                    Hashtable dronInfo = new Hashtable {
                        { (int)SPC.Target, targetObject.nebulaObject.Id },
                        { (int)SPC.TargetType, targetObject.nebulaObject.Type },
                        { (int)SPC.Damage, dronDamage.totalDamage }
                    };
                    mMessage.SendDamageDron(dronInfo);
                }
            }
        }
Example #28
0
    // Start is called before the first frame update
    void Awake()
    {
        //Temporarily disabled since it gave errors
        weaponDamage = GameObject.FindGameObjectWithTag("Weapon").GetComponent <WeaponDamage>();
        spellHit     = GameObject.FindGameObjectWithTag("SpellCollider").GetComponent <SpellHit>();
        anim         = GetComponent <Animator>();
        rb           = GetComponent <Rigidbody>();
        shovel       = GameObject.Find("Shovel").GetComponent <Renderer>();
        shield       = GameObject.Find("Shield").GetComponent <Renderer>();
        dashSmoker   = GetComponent <DashSmokeScripts>();
        noOfClicks   = 0;
        canClick     = true;
        endPosition  = new Vector3(0, 0, 0);

        //PhotonView
        PV = GetComponent <PhotonView>();


        // Input Controller Related Things Start Here ------------------------------------

        controls = new PlayerControls();

        // Rotation
        controls.Gameplay.Rotate.performed += ctx => rotateInput = ctx.ReadValue <Vector2>();
        controls.Gameplay.Rotate.canceled  += ctx => rotateInput = Vector2.zero;

        // Other Stuff
        controls.Gameplay.MeleeAttack.performed += ctx => MeleeAttack();
        controls.Gameplay.Spell1.performed      += ctx => Spell1();
        controls.Gameplay.Spell2.performed      += ctx => Spell2();
        controls.Gameplay.Walk.performed        += ctx => Walk();
        controls.Gameplay.Walk.canceled         += ctx => Run();
        controls.Gameplay.Interactive.performed += ctx => OnInteract();
        controls.Gameplay.Interactive.canceled  += ctx => NoInteract();
        controls.Gameplay.Pause.performed       += ctx => Pause();
        controls.Gameplay.AngleChange.performed += ctx => ChangeAngle();

        // Input Controller Related Things End Here --------------------------------------
    }
    private void OnTriggerEnter(Collider other)
    {
        WeaponDamage damageCollider = other.gameObject.GetComponent <WeaponDamage>();

        if (damageCollider != null && !isHit)
        {
            enemyHealth -= damageCollider.weaponDamageAmt;
            if (enemyHealth <= 0)
            {
                inventory.AddItem(itemDatabase.GetItemById(10), enemyMeatAMT);
                Destroy(enemyAIHolder);
            }
            else
            {
                isHit = true;
                enemyAnim.Play("rat_hit");
                StartCoroutine(damageCoolDown(0.5f));
                damageAudioSource.clip = damageAudio[0];
                damageAudioSource.Play();
            }
        }
    }
Example #30
0
        public virtual Hashtable Heal(NebulaObject targetObject, float healValue, int skillID = -1, bool generateCrit = true)
        {
            MakeMeVisible();

            WeaponDamage notCritDmg = GetDamage(false);
            WeaponDamage critDmg    = GetDamage(true);
            float        ratio      = critDmg.totalDamage / notCritDmg.totalDamage;

            healValue = Mathf.ClampLess(healValue * (1.0f + cachedBonuses.healingPcBonus) + cachedBonuses.healingCntBonus, 0f);

            bool isCritHeal = false;

            if (generateCrit)
            {
                if (Rand.Float01() < criticalChance)
                {
                    isCritHeal = true;
                    healValue *= ratio;
                }
            }

            var targetDamaable = targetObject.Damagable();

            targetDamaable.RestoreHealth(nebulaObject, healValue);

            nebulaObject.SendMessage(ComponentMessages.OnMakeHeal, healValue);

            StartHealDron(targetDamaable, healValue);

            if (isCritHeal)
            {
                nebulaObject.SendMessage(ComponentMessages.OnCriticalHeal, healValue);
            }

            return(ConstructHealMessage(nebulaObject, targetObject, cachedCharacter.workshop, skillID, healValue, isCritHeal));
        }
Example #31
0
        public WeaponDamage CalculateDamage(MaterialCollision[] collisions)
        {
            if (!_isFullySetUp || collisions.Length == 0)
            {
                return null;
            }

            double damangeMult = GetDamageMultiplier();
            if (Math1D.IsNearZero(damangeMult))
            {
                return null;
            }

            var avgCollision = MaterialCollision.GetAverageCollision(collisions, _bot.PhysicsBody);

            //TODO: See if this position is along the ramming direction

            double speed = avgCollision.Item2 / 10;     // a speed of 10 is considered an average impact speed

            double damage = speed * damangeMult;

            WeaponDamage retVal = new WeaponDamage(avgCollision.Item1, damage);

            // The act of hitting something needs to stop the ram, otherwise, they just keep pushing against the item
            // and continue to do damage
            StopRamming();

            return retVal;
        }
Example #32
0
        public TreasureBox(Point3D position, double mass, double hitPoints, int materialID, World world, WeaponDamage damageMultipliers, object[] containedTreasureDNA = null)
        {
            const double RADIUS = .75d / 2d;
            const double HEIGHT = 1.5d;

            const double RING_Z1 = (HEIGHT / 2d) * .5d;     // this is distance from the end cap
            const double RING_Z2 = (HEIGHT / 2d) - RING_Z1;     // this one is distance from the origin

            const double RINGRADIUS_INNER = RADIUS * .5d;
            const double RINGRADIUS_OUTER = RADIUS * 1.05d;
            const double RINGHEIGHT = HEIGHT * .05d;

            const int DOMESEGMENTS = 3;
            const int CYLINDERSEGMENTS = 8;
            const int RINGSEGMENTS = 8;

            #region WPF Model

            Model3DGroup geometries = new Model3DGroup();

            #region Barrel

            // Material
            MaterialGroup material = new MaterialGroup();
            material.Children.Add(new DiffuseMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("413D34"))));
            material.Children.Add(new SpecularMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("60C5CAA7")), 2d));// .25d));

            // Geometry Model
            GeometryModel3D geometry = new GeometryModel3D();
            geometry.Material = material;
            geometry.BackMaterial = material;

            List<TubeRingBase> rings = new List<TubeRingBase>();
            rings.Add(new TubeRingDome(0d, false, DOMESEGMENTS));
            rings.Add(new TubeRingRegularPolygon(RING_Z1, false, RADIUS, RADIUS, false));
            rings.Add(new TubeRingRegularPolygon(HEIGHT - (RING_Z1 * 2), false, RADIUS, RADIUS, false));
            rings.Add(new TubeRingDome(RING_Z1, false, DOMESEGMENTS));
            geometry.Geometry = UtilityWPF.GetMultiRingedTube(CYLINDERSEGMENTS, rings, true, true);

            geometries.Children.Add(geometry);

            #endregion

            #region Rings

            // Material
            material = new MaterialGroup();
            //material.Children.Add(new DiffuseMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("736E56"))));
            //material.Children.Add(new SpecularMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("B0EEF2CE")), .8d));
            material.Children.Add(new DiffuseMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("CCBF81"))));
            material.Children.Add(new SpecularMaterial(new SolidColorBrush(UtilityWPF.ColorFromHex("B0D9D78D")), 8));// .8d));

            // Ring 1
            // Geometry Model
            geometry = new GeometryModel3D();
            geometry.Material = material;
            geometry.BackMaterial = material;
            geometry.Geometry = UtilityWPF.GetRing(RINGSEGMENTS, RINGRADIUS_INNER, RINGRADIUS_OUTER, RINGHEIGHT, new TranslateTransform3D(0, 0, -RING_Z2), false);

            geometries.Children.Add(geometry);

            // Ring 2
            // Geometry Model
            geometry = new GeometryModel3D();
            geometry.Material = material;
            geometry.BackMaterial = material;
            geometry.Geometry = UtilityWPF.GetRing(RINGSEGMENTS, RINGRADIUS_INNER, RINGRADIUS_OUTER, RINGHEIGHT, new TranslateTransform3D(0, 0, RING_Z2), false);

            geometries.Children.Add(geometry);

            // Ring 3
            // Geometry Model
            geometry = new GeometryModel3D();
            geometry.Material = material;
            geometry.BackMaterial = material;
            geometry.Geometry = UtilityWPF.GetRing(RINGSEGMENTS, RINGRADIUS_INNER, RINGRADIUS_OUTER, RINGHEIGHT);

            geometries.Children.Add(geometry);

            #endregion

            geometries.Transform = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), 90));     // make this go along x instead of z

            this.Model = geometries;

            // Model Visual
            ModelVisual3D visual = new ModelVisual3D();        // this is the expensive one, so as few of these should be made as possible
            visual.Content = this.Model;

            #endregion

            #region Physics Body

            Transform3DGroup transform = new Transform3DGroup();
            //transform.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 90)));
            transform.Children.Add(new TranslateTransform3D(position.ToVector()));

            using (CollisionHull hull = CollisionHull.CreateCylinder(world, 0, RADIUS, HEIGHT, null))
            {
                this.PhysicsBody = new Body(hull, transform.Value, mass, new Visual3D[] { visual });
                this.PhysicsBody.MaterialGroupID = materialID;
                this.PhysicsBody.LinearDamping = 1d;
                this.PhysicsBody.AngularDamping = new Vector3D(.01d, .01d, .01d);

                //this.PhysicsBody.ApplyForceAndTorque += new EventHandler<BodyApplyForceAndTorqueArgs>(PhysicsBody_ApplyForceAndTorque);
            }

            #endregion

            this.Radius = Math.Sqrt((RADIUS * RADIUS) + ((HEIGHT / 2d) * (HEIGHT / 2d)));

            this.ReceiveDamageMultipliers = damageMultipliers ?? new WeaponDamage();

            this.HitPoints = new Container() { QuantityMax = hitPoints, QuantityCurrent = hitPoints };

            this.ContainedTreasureDNA = containedTreasureDNA;

            this.CreationTime = DateTime.UtcNow;
        }
Example #33
0
 public Tuple<bool, WeaponDamage> Damage(WeaponDamage damage, Weapon weapon = null)
 {
     return WeaponDamage.DoDamage(this, damage);
 }