當前位置: 首頁>>代碼示例>>C#>>正文


C# AttackData類代碼示例

本文整理匯總了C#中AttackData的典型用法代碼示例。如果您正苦於以下問題:C# AttackData類的具體用法?C# AttackData怎麽用?C# AttackData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttackData類屬於命名空間,在下文中一共展示了AttackData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Damage

 public Damage(float amount, AttackData attackData, RaycastHit hitLocation, Transform attackerTransform)
 {
     HitLocation = hitLocation;
     Amount = amount;
     Attacker = attackerTransform;
     Attack = attackData;
 }
開發者ID:redbluegames,項目名稱:ness,代碼行數:7,代碼來源:Damage.cs

示例2: StealLife

        /// <summary>
        /// Uses percent of damage to heal the caster
        /// </summary>
        public virtual void StealLife(AttackData ad)
        {
            if (ad == null) return;
            if (!m_caster.IsAlive) return;

            if (ad.Target is Keeps.GameKeepDoor || ad.Target is Keeps.GameKeepComponent)
            {
                return;
            }

            int heal = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn / 100;
            if (m_caster.IsDiseased)
            {
                MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
                heal >>= 1;
            }
            if (heal <= 0) return;
            heal = m_caster.ChangeHealth(m_caster, GameLiving.eHealthChangeType.Spell, heal);

            if (heal > 0)
            {
                MessageToCaster("You steal " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
            }
        }
開發者ID:uvbs,項目名稱:Dawn-of-Light-core,代碼行數:31,代碼來源:DamageSpeedDecrease.cs

示例3: EventHandler

        /// <summary>
        /// Handler fired on every melee attack by effect target
        /// </summary>
        /// <param name="e"></param>
        /// <param name="sender"></param>
        /// <param name="arguments"></param>
        protected void EventHandler(DOLEvent e, object sender, EventArgs arguments)
        {
            AttackFinishedEventArgs atkArgs = arguments as AttackFinishedEventArgs;
            if (atkArgs == null) return;
            if (atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitUnstyled
                && atkArgs.AttackData.AttackResult != GameLiving.eAttackResult.HitStyle) return;
            if (atkArgs.AttackData.Target == null) return;
            GameLiving target = atkArgs.AttackData.Target;
            if (target == null) return;
            if (target.ObjectState != GameObject.eObjectState.Active) return;
            if (target.IsAlive == false) return;
            GameLiving attacker = sender as GameLiving;
            if (attacker == null) return;
            if (attacker.ObjectState != GameObject.eObjectState.Active) return;
            if (attacker.IsAlive == false) return;
            if (atkArgs.AttackData.IsOffHand) return; // only react to main hand
            if (atkArgs.AttackData.Weapon == null) return; // no weapon attack

            int modifier = 100;
            //double dpsCap = (1.2 + 0.3 * attacker.Level) * 0.7;
            //double dps = Math.Min(atkArgs.AttackData.Weapon.DPS_AF/10.0, dpsCap);
            double baseDamage = atkArgs.AttackData.Weapon.DPS_AF / 10.0 *
                                atkArgs.AttackData.WeaponSpeed;

            modifier += (int)(25 * atkArgs.AttackData.Target.GetConLevel(atkArgs.AttackData.Attacker));
            modifier = Math.Min(300, modifier);
            modifier = Math.Max(75, modifier);

            double damage = baseDamage * modifier * 0.001; // attack speed is 10 times higher (2.5spd=25)
            double damageResisted = damage * target.GetResist(eDamageType.Body) * -0.01;

            AttackData ad = new AttackData();
            ad.Attacker = attacker;
            ad.Target = target;
            ad.Damage = (int)(damage + damageResisted);
            ad.Modifier = (int)damageResisted;
            ad.DamageType = eDamageType.Body;
            ad.AttackType = AttackData.eAttackType.MeleeOneHand;
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.WeaponSpeed = atkArgs.AttackData.WeaponSpeed;

            GamePlayer owner = attacker as GamePlayer;
            if (owner != null)
            {
                owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.MBHitsExtraDamage", target.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                GamePlayer playerTarget = target as GamePlayer;
                if (playerTarget != null)
                {
                    owner.Out.SendMessage(LanguageMgr.GetTranslation(owner.Client, "Effects.TripleWieldEffect.XMBExtraDamageToYou", attacker.GetName(0, false), ad.Damage), eChatType.CT_Spell, eChatLoc.CL_SystemWindow);
                }
            }

            target.OnAttackedByEnemy(ad);
            attacker.DealDamage(ad);

            foreach (GamePlayer player in ad.Attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
            {
                player.Out.SendCombatAnimation(null, target, 0, 0, 0, 0, 0x0A, target.HealthPercent);
            }
        }
開發者ID:uvbs,項目名稱:Dawn-of-Light-core,代碼行數:66,代碼來源:TripleWieldEffect.cs

示例4: DrainPower

        public override void DrainPower(AttackData ad)
        {
            if ( !(m_caster is NecromancerPet))
                return;

            base.DrainPower(ad);
        }
開發者ID:mynew4,項目名稱:DOLSharp,代碼行數:7,代碼來源:PowerDrain.cs

示例5: DamageTarget

        public override void DamageTarget(AttackData ad, bool showEffectAnimation)
        {
            if(ad.Damage > 0 && ad.Target is GameNPC)
            {
                if(!(Caster is GamePlayer)) return;
                IOldAggressiveBrain aggroBrain = ((GameNPC) ad.Target).Brain as IOldAggressiveBrain;
                if(aggroBrain != null)
                {
                    TurretPet turret = null;
                    if(Caster.TargetObject == null || !Caster.IsControlledNPC(Caster.TargetObject as TurretPet))
                    {
                        if(Caster.ControlledBrain != null && Caster.ControlledBrain.Body != null)
                        {
                            turret = Caster.ControlledBrain.Body as TurretPet;
                        }
                    }
                    else if(Caster.IsControlledNPC(Caster.TargetObject as TurretPet))
                    {
                        turret = Caster.TargetObject as TurretPet;
                    }

                    if(turret != null)
                    {
                        //pet will take aggro
                        AttackData turretAd = ad;
                        turretAd.Attacker = turret;
                        ad.Target.OnAttackedByEnemy(turretAd);

                        aggroBrain.AddToAggroList(turret, (ad.Damage + ad.CriticalDamage)*3);
                    }
                    aggroBrain.AddToAggroList(Caster, ad.Damage);
                }
            }
            base.DamageTarget(ad, showEffectAnimation);
        }
開發者ID:mynew4,項目名稱:DOLSharp,代碼行數:35,代碼來源:PetPBAoE.cs

示例6: GenerateID

 /// <summary>
 /// Utility method to generate attack IDs.
 /// </summary>
 /// <param name="data">The data to create an id for.</param>
 /// <returns>An entirely unique id for the data.</returns>
 protected virtual int GenerateID(AttackData data)
 {
     var id = data.GetHashCode () * 23;
     id <<= data.Priority;
     id <<= 5;
     id *= Time.frameCount;
     return id;
 }
開發者ID:UTC-SkillsUSA-2015,項目名稱:SkillsUSA-2015,代碼行數:13,代碼來源:AbstractAttackingHitbox.cs

示例7: Attack

 public Attack(AttackData data, int team, int id, float damageMult = 1.00f,
     float xKnockbackMult = 1.00f, float yKnockbackMult = 1.00f)
 {
     kData = data;
     kTeam = team;
     kId = id;
     damageMultiplier = damageMult;
     launchScale = new Vector2 (xKnockbackMult, yKnockbackMult);
 }
開發者ID:UTC-SkillsUSA-2015,項目名稱:SkillsUSA-2015,代碼行數:9,代碼來源:Attack.cs

示例8: Attack

    public Attack(AttackData atk)
    {
        this.aName = atk.aName;
        this.range = atk.range;
        this.dmg = atk.dmg;
        this.roll = atk.roll;
        this.nDice = atk.nDice;

        foreach (DamageType x in atk.dmgTypes)
            dmgTypes.Add(x);
    }
開發者ID:ExaltedBagel,項目名稱:TargetPractice,代碼行數:11,代碼來源:Attack.cs

示例9: Start

    void Start()
    {
        victim.ownerPlayer = Network.player.guid;

        var _attackData = new AttackData(100)
        {
            ownerPlayer = Network.player.guid,
            projectile = ProjectileType.RED_BULLET,
            weapon = WeaponType.ASSAULT_RIFLE,
        };

        victim.Hit(_attackData);

        bangEntity.Refresh(victim);
    }
開發者ID:JamesKim2998,項目名稱:snugdc-project-ricochet,代碼行數:15,代碼來源:HUDBangEntityTest.cs

示例10: SendAttackCoord

    public void SendAttackCoord(int charId, float fireForce, Quaternion fireAngle, CharacterCoord fireCoord)
    {
        if(network != null)
        {
            // 패킷 데이터 만들기
            AttackData data = new AttackData();
            data.characterId = charId;
            data.fireForce = fireForce;
            data.fireAngle = fireAngle;
            data.fireCoord = fireCoord;

            // 데이터를 UDP송신
            AttackPacket packet = new AttackPacket(data);
            network.SendUnreliableToAll<AttackData>(packet);
        }
    }
開發者ID:lastone9182,項目名稱:NetworkProgramming,代碼行數:16,代碼來源:CharacterRoot.cs

示例11: StealEndo

		/// <summary>
		/// Uses percent of damage to renew endurance
		/// </summary>
		public virtual void StealEndo(AttackData ad)
		{
			if (ad == null) return;
			if (!m_caster.IsAlive) return;

			int renew = ((ad.Damage + ad.CriticalDamage) * Spell.ResurrectHealth / 100) * Spell.LifeDrainReturn / 100; // %endo returned
            renew = m_caster.ChangeEndurance(m_caster, GameLiving.eEnduranceChangeType.Spell, renew);
			if (renew > 0)
			{
				MessageToCaster("You steal " + renew + " endurance.", eChatType.CT_Spell);
			}
			else
			{
				MessageToCaster("You cannot steal any more endurance.", eChatType.CT_SpellResisted);
			}
		}
開發者ID:boscorillium,項目名稱:dol,代碼行數:19,代碼來源:OmniLifedrainSpellHandler.cs

示例12: StealLife

        /// <summary>
        /// Uses percent of damage to heal the caster
        /// </summary>
        public override void StealLife(AttackData ad)
        {
            if (ad == null) return;
            if (!Caster.IsAlive) return;

            int heal = (ad.Damage + ad.CriticalDamage) * 35 / 100;
            int mana = (ad.Damage + ad.CriticalDamage) * 21 / 100;
            int endu = (ad.Damage + ad.CriticalDamage) * 14 / 100;

            if (Caster.IsDiseased)
            {
                MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
                heal >>= 1;
            }
            if (heal <= 0) return;
            heal = Caster.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, heal);
            if (heal > 0)
            {
                MessageToCaster("You drain " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
            }

            if (mana <= 0) return;
            mana = Caster.ChangeMana(Caster, GameLiving.eManaChangeType.Spell, mana);
            if (mana > 0)
            {
                MessageToCaster("You drain " + mana + " power point" + (mana == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more power.", eChatType.CT_SpellResisted);
            }

            if (endu <= 0) return;
            endu = Caster.ChangeEndurance(Caster, GameLiving.eEnduranceChangeType.Spell, endu);
            if (heal > 0)
            {
                MessageToCaster("You drain " + endu + " endurance point" + (endu == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more endurance.", eChatType.CT_SpellResisted);
            }
        }
開發者ID:uvbs,項目名稱:Dawn-of-Light-core,代碼行數:50,代碼來源:TartarosGift.cs

示例13: DrainPower

        /// <summary>
        /// Use a percentage of the damage to refill caster's power.
        /// </summary>
        /// <param name="ad">Attack data.</param>
        public virtual void DrainPower(AttackData ad)
        {
            if (ad == null || !m_caster.IsAlive)
                return;

            GameLiving owner = Owner();
            if (owner == null)
                return;

            int powerGain = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn / 100;
            powerGain = owner.ChangeMana(m_caster, GameLiving.eManaChangeType.Spell, powerGain);

            if (powerGain > 0)
                MessageToOwner(String.Format("Your summon channels {0} power to you!", powerGain), eChatType.CT_Spell);
            else
                MessageToOwner("You cannot absorb any more power.", eChatType.CT_SpellResisted);
        }
開發者ID:mynew4,項目名稱:DOLSharp,代碼行數:21,代碼來源:PowerDrain.cs

示例14: Damage

    public void Damage(AttackData attackData)
    {
        if (! enabled)
        {
            // Debug.Log("DamageDetector already disabled!");
            return;
        }

        if (m_DoDamage != null)
        {
            m_DoDamage(attackData);
        }
        else
        {
            Debug.Log("doDamage is not set!");
        }
    }
開發者ID:JamesKim2998,項目名稱:snugdc-project-ricochet,代碼行數:17,代碼來源:DamageDetector.cs

示例15: CalculateDamageToTarget

        public override AttackData CalculateDamageToTarget( GameLiving target, double effectiveness )
        {
            int bleedValue = target.TempProperties.getProperty<int>( BLEED_VALUE_PROPERTY);

            AttackData ad = new AttackData();
            ad.Attacker = Caster;
            ad.Target = target;
            ad.AttackType = AttackData.eAttackType.Spell;
            ad.Modifier = bleedValue * ad.Target.GetResist( Spell.DamageType ) / -100;
            ad.Damage = bleedValue + ad.Modifier;
            ad.DamageType = Spell.DamageType;
            ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
            ad.SpellHandler = this;
            ad.CausesCombat = false;

            return ad;
        }
開發者ID:mynew4,項目名稱:DOLSharp,代碼行數:17,代碼來源:StyleBleeding.cs


注:本文中的AttackData類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。