internal static bool ApplyHorseCrippleLogic(Agent victim, BoneBodyPartType victimHitBodyPart)
            {
                bool makesRear = false;

                if (Config.ConfigSettings.HorseProjectileCrippleEnabled)
                {
                    if (victim != null && victim.IsMount)
                    {
                        if (victim.RiderAgent != null && !victim.RiderAgent.IsMainAgent)
                        {
                            if (victimHitBodyPart == BoneBodyPartType.Head || victimHitBodyPart == BoneBodyPartType.Neck)
                            {
                                makesRear = Config.ConfigSettings.HorseHeadshotRearingEnabled;
                            }
                            else
                            {
                                if (victim.IsActive() && victim.RiderAgent)
                                {
                                    victim.RiderAgent.AgentDrivenProperties.MountSpeed = 0f;
                                    HorseCrippleLogic.CrippleHorseNew(victim, MissionTime.SecondsFromNow((float)Config.ConfigSettings.HorseProjectileCrippleDuration));
                                    victim.UpdateAgentStats();
                                }
                            }
                        }
                    }
                }

                return(makesRear);
            }
        public override void OnScoreHit(
            Agent affectedAgent,
            Agent affectorAgent,
            WeaponComponentData attackerWeapon,
            bool isBlocked,
            float damage,
            float movementSpeedDamageModifier,
            float hitDistance,
            AgentAttackType attackType,
            float shotDifficulty,
            BoneBodyPartType victimHitBodyPart)
        {
            bool flag1 = affectorAgent != null && affectorAgent.IsMainAgent;

            if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman))
            {
                return;
            }
            HighlightsController.Highlight highlight = new HighlightsController.Highlight();
            highlight.Start = Mission.Current.Time;
            highlight.End   = Mission.Current.Time;
            bool flag2 = false;

            if (flag1 && (double)shotDifficulty >= 7.5)
            {
                highlight.HighlightType = this.GetHighlightTypeWithId("hlid_high_ranged_shot_difficulty");
                flag2 = true;
            }
            if (flag1 && affectedAgent.HasMount && (attackType == AgentAttackType.Standard && affectorAgent.HasMount) && affectorAgent.IsDoingPassiveAttack)
            {
                highlight.HighlightType = this.GetHighlightTypeWithId("hlid_couched_lance_against_mounted_opponent");
                flag2 = true;
            }
            if (this._isFirstImpact && affectorAgent.Formation != null && (affectorAgent.Formation.IsCavalry() && affectorAgent.Formation.MovementOrder == (object)MovementOrder.MovementOrderCharge) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"), affectedAgent.Position))
            {
                this._cavalryChargeHitTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 3.0 < (double)Mission.Current.Time));
                this._cavalryChargeHitTimes.Add(Mission.Current.Time);
                if (this._cavalryChargeHitTimes.Count >= 5)
                {
                    highlight.HighlightType = this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact");
                    highlight.Start         = this._cavalryChargeHitTimes[0];
                    highlight.End           = this._cavalryChargeHitTimes.Last <float>();
                    flag2 = true;
                    this._isFirstImpact = false;
                    this._cavalryChargeHitTimes.Clear();
                }
            }
            if (!flag2)
            {
                return;
            }
            this.SaveHighlight(highlight, affectedAgent.Position);
        }
示例#3
0
 public override void OnScoreHit(
     Agent affectedAgent,
     Agent affectorAgent,
     WeaponComponentData attackerWeapon,
     bool isBlocked,
     float damage,
     float movementSpeedDamageModifier,
     float hitDistance,
     AgentAttackType attackType,
     float shotDifficulty,
     BoneBodyPartType victimHitBodyPart)
 {
     if (!GameNetwork.IsServer || isBlocked || (affectorAgent == affectedAgent || affectorAgent.MissionPeer == null) || (double)damage <= 0.0)
     {
         return;
     }
     affectedAgent.AddHitter(affectorAgent.MissionPeer, damage, affectorAgent.IsFriendOf(affectedAgent));
 }
 public static AttackCollisionData GetAttackCollisionDataForDebugPurpose(
     bool _attackBlockedWithShield,
     bool _correctSideShieldBlock,
     bool _isAlternativeAttack,
     bool _isColliderAgent,
     bool _collidedWithShieldOnBack,
     bool _isMissile,
     bool _isMissileBlockedWithWeapon,
     bool _missileHasPhysics,
     bool _entityExists,
     bool _thrustTipHit,
     bool _missileGoneUnderWater,
     CombatCollisionResult collisionResult,
     int affectorWeaponSlotOrMissileIndex,
     int StrikeType,
     int DamageType,
     sbyte CollisionBoneIndex,
     BoneBodyPartType VictimHitBodyPart,
     sbyte AttackBoneIndex,
     Agent.UsageDirection AttackDirection,
     int PhysicsMaterialIndex,
     CombatHitResultFlags CollisionHitResultFlags,
     float AttackProgress,
     float CollisionDistanceOnWeapon,
     float AttackerStunPeriod,
     float DefenderStunPeriod,
     float MissileTotalDamage,
     float MissileInitialSpeed,
     float ChargeVelocity,
     float FallSpeed,
     Vec3 WeaponRotUp,
     Vec3 _weaponBlowDir,
     Vec3 CollisionGlobalPosition,
     Vec3 MissileVelocity,
     Vec3 MissileStartingPosition,
     Vec3 VictimAgentCurVelocity,
     Vec3 GroundNormal)
 {
     return(new AttackCollisionData(_attackBlockedWithShield, _correctSideShieldBlock, _isAlternativeAttack, _isColliderAgent, _collidedWithShieldOnBack, _isMissile, _isMissileBlockedWithWeapon, _missileHasPhysics, _entityExists, _thrustTipHit, _missileGoneUnderWater, collisionResult, affectorWeaponSlotOrMissileIndex, StrikeType, DamageType, CollisionBoneIndex, VictimHitBodyPart, AttackBoneIndex, AttackDirection, PhysicsMaterialIndex, CollisionHitResultFlags, AttackProgress, CollisionDistanceOnWeapon, AttackerStunPeriod, DefenderStunPeriod, MissileTotalDamage, MissileInitialSpeed, ChargeVelocity, FallSpeed, WeaponRotUp, _weaponBlowDir, CollisionGlobalPosition, MissileVelocity, MissileStartingPosition, VictimAgentCurVelocity, GroundNormal));
 }
示例#5
0
            static bool Prefix(Agent __instance, BoneBodyPartType bodyPart, ref float __result)
            {
                if (!__instance.IsHuman)
                {
                    switch (bodyPart)
                    {
                    case BoneBodyPartType.None:
                    {
                        __result = 10f;
                        break;
                    }

                    case BoneBodyPartType.Head:
                    {
                        __result = getHorseHeadArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.Neck:
                    {
                        __result = getHorseArmArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.Legs:
                    case BoneBodyPartType.ArmLeft:
                    case BoneBodyPartType.ArmRight:
                    {
                        __result = (getHorseLegArmor(__instance) * 2f + getHorseBodyArmor(__instance)) / 3f;
                        break;
                    }

                    case BoneBodyPartType.Chest:
                    {
                        __result = (getHorseLegArmor(__instance) + getHorseBodyArmor(__instance)) / 2f;
                        break;
                    }

                    case BoneBodyPartType.ShoulderLeft:
                    case BoneBodyPartType.ShoulderRight:
                    {
                        __result = getHorseBodyArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.Abdomen:
                    {
                        __result = getHorseLegArmor(__instance);
                        break;
                    }

                    default:
                    {
                        _        = 10;
                        __result = 10f;
                        break;
                    }
                    }
                }

                else
                {
                    switch (bodyPart)
                    {
                    case BoneBodyPartType.None:
                    {
                        __result = 0f;
                        break;
                    }

                    case BoneBodyPartType.Head:
                    {
                        __result = __instance.GetAgentDrivenPropertyValue(DrivenProperty.ArmorHead);
                        break;
                    }

                    case BoneBodyPartType.Neck:
                    {
                        __result = __instance.GetAgentDrivenPropertyValue(DrivenProperty.ArmorHead) * 0.66f;
                        break;
                    }

                    case BoneBodyPartType.Legs:
                    {
                        __result = getLegArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.ArmLeft:
                    case BoneBodyPartType.ArmRight:
                    {
                        __result = getArmArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.Chest:
                    {
                        __result = getMyChestArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.ShoulderLeft:
                    case BoneBodyPartType.ShoulderRight:
                    {
                        __result = getShoulderArmor(__instance);
                        break;
                    }

                    case BoneBodyPartType.Abdomen:
                    {
                        __result = getAbdomenArmor(__instance);
                        break;
                    }

                    default:
                    {
                        _        = 3;
                        __result = 3f;
                        break;
                    }
                    }
                }

                return(false);
            }
 private AttackCollisionData(
     bool attackBlockedWithShield,
     bool correctSideShieldBlock,
     bool isAlternativeAttack,
     bool isColliderAgent,
     bool collidedWithShieldOnBack,
     bool isMissile,
     bool missileBlockedWithWeapon,
     bool missileHasPhysics,
     bool entityExists,
     bool thrustTipHit,
     bool missileGoneUnderWater,
     CombatCollisionResult collisionResult,
     int affectorWeaponSlotOrMissileIndex,
     int StrikeType,
     int DamageType,
     sbyte CollisionBoneIndex,
     BoneBodyPartType VictimHitBodyPart,
     sbyte AttackBoneIndex,
     Agent.UsageDirection AttackDirection,
     int PhysicsMaterialIndex,
     CombatHitResultFlags CollisionHitResultFlags,
     float AttackProgress,
     float CollisionDistanceOnWeapon,
     float AttackerStunPeriod,
     float DefenderStunPeriod,
     float MissileTotalDamage,
     float MissileStartingBaseSpeed,
     float ChargeVelocity,
     float FallSpeed,
     Vec3 WeaponRotUp,
     Vec3 weaponBlowDir,
     Vec3 CollisionGlobalPosition,
     Vec3 MissileVelocity,
     Vec3 MissileStartingPosition,
     Vec3 VictimAgentCurVelocity,
     Vec3 GroundNormal)
 {
     this._attackBlockedWithShield  = attackBlockedWithShield;
     this._correctSideShieldBlock   = correctSideShieldBlock;
     this._isAlternativeAttack      = isAlternativeAttack;
     this._isColliderAgent          = isColliderAgent;
     this._collidedWithShieldOnBack = collidedWithShieldOnBack;
     this._isMissile = isMissile;
     this._missileBlockedWithWeapon        = missileBlockedWithWeapon;
     this._missileHasPhysics               = missileHasPhysics;
     this._entityExists                    = entityExists;
     this._thrustTipHit                    = thrustTipHit;
     this._missileGoneUnderWater           = missileGoneUnderWater;
     this._collisionResult                 = (int)collisionResult;
     this.AffectorWeaponSlotOrMissileIndex = affectorWeaponSlotOrMissileIndex;
     this.StrikeType                = StrikeType;
     this.DamageType                = DamageType;
     this.CollisionBoneIndex        = CollisionBoneIndex;
     this.VictimHitBodyPart         = VictimHitBodyPart;
     this.AttackBoneIndex           = AttackBoneIndex;
     this.AttackDirection           = AttackDirection;
     this.PhysicsMaterialIndex      = PhysicsMaterialIndex;
     this.CollisionHitResultFlags   = CollisionHitResultFlags;
     this.AttackProgress            = AttackProgress;
     this.CollisionDistanceOnWeapon = CollisionDistanceOnWeapon;
     this.AttackerStunPeriod        = AttackerStunPeriod;
     this.DefenderStunPeriod        = DefenderStunPeriod;
     this.MissileTotalDamage        = MissileTotalDamage;
     this.MissileStartingBaseSpeed  = MissileStartingBaseSpeed;
     this.ChargeVelocity            = ChargeVelocity;
     this.FallSpeed                   = FallSpeed;
     this.WeaponRotUp                 = WeaponRotUp;
     this._weaponBlowDir              = weaponBlowDir;
     this.CollisionGlobalPosition     = CollisionGlobalPosition;
     this.MissileVelocity             = MissileVelocity;
     this.MissileStartingPosition     = MissileStartingPosition;
     this.VictimAgentCurVelocity      = VictimAgentCurVelocity;
     this.CollisionGlobalNormal       = GroundNormal;
     this.BaseMagnitude               = 0.0f;
     this.MovementSpeedDamageModifier = 0.0f;
     this.AbsorbedByArmor             = 0;
     this.InflictedDamage             = 0;
     this.SelfInflictedDamage         = 0;
     this.IsShieldBroken              = false;
 }
示例#7
0
 public abstract float GetDamageMultiplierForBodyPart(
     BoneBodyPartType bodyPart,
     DamageTypes type);
示例#8
0
            static bool Prefix(Agent __instance, BoneBodyPartType bodyPart, ref float __result)
            {
                if (!__instance.IsHuman)
                {
                    __result = __instance.GetAgentDrivenPropertyValue(DrivenProperty.ArmorTorso);
                    return(false);
                }
                switch (bodyPart)
                {
                case BoneBodyPartType.None:
                {
                    __result = 0f;
                    break;
                }

                case BoneBodyPartType.Head:
                {
                    __result = __instance.GetAgentDrivenPropertyValue(DrivenProperty.ArmorHead);
                    break;
                }

                case BoneBodyPartType.Neck:
                {
                    __result = __instance.GetAgentDrivenPropertyValue(DrivenProperty.ArmorHead) * 0.8f;
                    break;
                }

                case BoneBodyPartType.BipedalLegs:
                case BoneBodyPartType.QuadrupedalLegs:
                {
                    __result = getLegArmor(__instance);
                    break;
                }

                case BoneBodyPartType.BipedalArmLeft:
                case BoneBodyPartType.BipedalArmRight:
                case BoneBodyPartType.QuadrupedalArmLeft:
                case BoneBodyPartType.QuadrupedalArmRight:
                {
                    __result = getArmArmor(__instance);
                    break;
                }

                case BoneBodyPartType.Chest:
                {
                    __result = getMyChestArmor(__instance);
                    break;
                }

                case BoneBodyPartType.ShoulderLeft:
                case BoneBodyPartType.ShoulderRight:
                {
                    __result = getShoulderArmor(__instance);
                    break;
                }

                case BoneBodyPartType.Abdomen:
                {
                    __result = getAbdomenArmor(__instance);
                    break;
                }

                default:
                {
                    _        = 3;
                    __result = 3f;
                    break;
                }
                }
                return(false);
            }