Наследование: MonoBehaviour
Пример #1
0
 /// <summary>
 ///     Initializes a new instance of the DamageEventArgs class.
 /// </summary>
 /// <param name="otherPlayer">The other player.</param>
 /// <param name="amount">Amount of damage done.</param>
 /// <param name="weapon">Weapon used to damage another.</param>
 /// <param name="bodypart">BodyPart shot at.</param>
 public DamageEventArgs(BasePlayer otherPlayer, float amount, Weapon weapon, BodyPart bodypart)
 {
     OtherPlayer = otherPlayer;
     Amount = amount;
     Weapon = weapon;
     BodyPart = bodypart;
 }
 public ItemInspector(IContent item, ContentItemMetadata metadata) {
     _item = item;
     _metadata = metadata;
     _common = item.Get<ICommonPart>();
     _routable = item.Get<RoutePart>();
     _body = item.Get<BodyPart>();
 }
 public TargetingDummyElement(string spriteName, BodyPart part, IResourceManager resourceManager)
 {
     _resourceManager = resourceManager;
     BodyPart = part;
     _elementSprite = _resourceManager.GetSprite(spriteName);
     Update(0);
 }
Пример #4
0
	public Demon(BodyPart _head, BodyPart _body, BodyPart _legs,
		BodyPart _appendages, BodyPart _decor)
	{
		head = _head;
		body = _body;
		legs = _legs;
		appendages = _appendages;
		decor = _decor;

		//build up other attributes
		hp = head.hp + body.hp + legs.hp + appendages.hp + decor.hp;
		offense = head.offense + body.offense + legs.offense + 
			appendages.offense + decor.offense;
		defense = head.defense + body.defense + legs.defense + 
			appendages.defense + decor.defense;
		//TODO: same for other attributes, including flesh/iron/ice
		//...
		maxHp = hp;
		flight = head.flight || body.flight || legs.flight || 
			appendages.flight || decor.flight;
		sight = head.sight || body.sight || legs.sight || 
			appendages.sight || decor.sight;
		iq = head.iq || body.iq || legs.iq || appendages.iq || decor.iq;
		charm = head.charm || body.charm || legs.charm || appendages.charm || 
			decor.charm;

		//determine skills randomly
		//TODO: rand() 0-1 and determine skill from each BodyPart


	}
 private string BodyPartMessage(BodyPart part)
 {
     string message = "";
     switch (part)
     {
         case BodyPart.Groin:
             message = "nuts";
             break;
         case BodyPart.Torso:
             message = "chest";
             break;
         case BodyPart.Head:
             message = "head";
             break;
         case BodyPart.Left_Arm:
             message = "arm";
             break;
         case BodyPart.Right_Arm:
             message = "arm";
             break;
         case BodyPart.Left_Leg:
             message = "leg";
             break;
         case BodyPart.Right_Leg:
             message = "leg";
             break;
     }
     return message;
 }
Пример #6
0
    void Start()
    {
        // store the Animator component
        animator = GetComponent<Animator>();
        tpController = GetComponent<ThirdPersonController>();
        // find character chest and hips
        characterChest = animator.GetBoneTransform(HumanBodyBones.Chest);
        characterHips = animator.GetBoneTransform(HumanBodyBones.Hips);

        // set all RigidBodies to kinematic so that they can be controlled with Mecanim
        // and there will be no glitches when transitioning to a ragdoll
        setKinematic(true);
        setCollider(true);

        // find all the transforms in the character, assuming that this script is attached to the root
        Component[] components = GetComponentsInChildren(typeof(Transform));

        // for each of the transforms, create a BodyPart instance and store the transform 
        foreach (Component c in components)
        {
            BodyPart bodyPart = new BodyPart();
            bodyPart.transform = c as Transform;
            bodyParts.Add(bodyPart);
        }
    }
Пример #7
0
 private static string GetFlavor(BodyPart part)
 {
     var typePartSettings = part.Settings.GetModel<BodyTypePartSettings>();
     return (typePartSettings != null && !string.IsNullOrWhiteSpace(typePartSettings.Flavor))
                ? typePartSettings.Flavor
                : part.PartDefinition.Settings.GetModel<BodyPartSettings>().FlavorDefault;
 }
 public void setBodyParts(BodyPart[] parts, Aspects.Secondary type)
 {
     foreach (BodyPart part in parts)
     {
         setBodyPart(part, type);
     }
 }
Пример #9
0
        public BodyPart requiredpart(int partIndex)
        {
            BodyPart part = null;

            switch (partIndex)
            {
                case 0:
                    part = new BodyPart("images/Fairy_0.png", "Fairy");
                    break;
                case 1:
                    part = new BodyPart("images/Frankenstein_0.png", "Frankenstein");
                    break;
                case 2:
                    part = new BodyPart("images/Skeleton_0.png", "Skeleton");
                    break;
                case 3:
                    part = new BodyPart("images/Vampire_0.png", "Vampire");
                    break;
                case 4:
                    part = new BodyPart("images/Werewolf_0.png", "Werewolf");
                    break;
                case 5:
                    part = new BodyPart("images/Witch_0.png", "Witch");
                    break;
            }

            return part;
        }
Пример #10
0
 public Armor(int armorMin, int durability, ArmorTypes type, int armorMax, BodyPart equipLocation)
 {
     this.Name = type.ToString();
     this.Durability = durability;
     this.EquipLocation = BodyPart.Chest;
     this.ArmorValue = GetArmorValue(armorMin, armorMax);
     this.EquipLocation = equipLocation;
 }
Пример #11
0
 public ItemInspector(IContent item, ContentItemMetadata metadata, IEnumerable<IHtmlFilter> htmlFilters) {
     _item = item;
     _metadata = metadata;
     _htmlFilters = htmlFilters;
     _common = item.Get<ICommonPart>();
     _titleAspect = item.Get<ITitleAspect>();
     _body = item.Get<BodyPart>();
 }
Пример #12
0
 public Sprite getSprite(Aspects.Secondary type, BodyPart bodyPart)
 {
     if (sprites.ContainsKey(type)) {
         return sprites[type][bodyPart];
     } else {
         Debug.Log("No sprites for player type " + type);
         return sprites[Aspects.Secondary.NONE][bodyPart];
     }
 }
Пример #13
0
        public void Given_body_part_is_in_list_when_AddBodyPart_then_body_part_is_not_duplicated()
        {
            //given
            var bodyPart = new BodyPart() { Id = 3425, Description = "Finger nail" };

            var target = new AccidentRecord();

            target.AddBodyPartThatWasInjured(bodyPart, null);
            target.AddBodyPartThatWasInjured(bodyPart, null);

            Assert.AreEqual(1, target.AccidentRecordBodyParts.Count);
        }
Пример #14
0
        public void Given_body_part_list_is_empty_when_AddBodyPart_then_body_part_appears_in_list()
        {
            //given
            var bodyPart = new BodyPart() { Id = 3425, Description = "Toe nail" };

            var target = new AccidentRecord();

            target.AddBodyPartThatWasInjured(bodyPart, null);

            Assert.IsTrue(target.AccidentRecordBodyParts.Any(x => x.BodyPart.Id == bodyPart.Id));

            Assert.AreEqual(target, target.AccidentRecordBodyParts.First(x => x.BodyPart.Id == bodyPart.Id));
        }
Пример #15
0
 protected override DriverResult Display(BodyPart part, string displayType, dynamic shapeHelper)
 {
     return Combined(
         ContentShape("Parts_Common_Body",
                      () => {
                          var bodyText = GetFallbackBodyText(part);
                          return shapeHelper.Parts_Common_Body(ContentPart: part, Html: new HtmlString(bodyText));
                      }),
         ContentShape("Parts_Common_Body_Summary",
                      () => {
                          var bodyText = GetBodyText(part);
                          return shapeHelper.Parts_Common_Body_Summary(ContentPart: part, Html: new HtmlString(bodyText));
                      })
         );
 }
Пример #16
0
        private string GetFallbackBodyText(BodyPart part)
        {
            var locPart = part.ContentItem.Parts.OfType<LocalizationPart>().SingleOrDefault();
            if(locPart!=null) {

                var currentCulture = locPart.Culture.Culture;//_services.WorkContext.CurrentCulture;
                var siteCulture = _cutureManager.GetSiteCulture();
                var partText = GetBodyText(part);

                if (string.IsNullOrWhiteSpace(partText) && siteCulture != currentCulture) {

                    var master = locPart.MasterContentItem.ContentItem.Parts.OfType<BodyPart>().SingleOrDefault();
                    return GetBodyText(master);
                }
            }
            return GetBodyText(part);
        }
Пример #17
0
        public void Given_bodypart_is_not_in_list_when_RemoveInjury_then_Injury_list_remains_the_same()
        {
            //given
            var bodypart = new BodyPart() { Id = 3425, Description = "Anterior cruciate ligament" };
            var bodypart2 = new BodyPart() { Id = 123124, Description = "Hip flexior" };

            var target = new AccidentRecord();

            target.AddBodyPartThatWasInjured(bodypart, null);
            target.AddBodyPartThatWasInjured(bodypart2, null);

            //when
            target.RemoveBodyPartThatWasInjured(new BodyPart() { Id = 124314, Description = "Test" }, null);


            Assert.AreEqual(2, target.AccidentRecordBodyParts.Count);
        }
Пример #18
0
        public void Given_bodypart_is_in_list_when_RemoveInjury_then_Injury_removed_from_list()
        {
            //given
            var bodypart = new BodyPart() { Id = 3425, Description = "Anterior cruciate ligament", Deleted = false};
            var bodypart2 = new BodyPart() { Id = 123124, Description = "Hip flexior", Deleted = false };

            var target = new AccidentRecord();

            target.AddBodyPartThatWasInjured(bodypart, null);
            target.AddBodyPartThatWasInjured(bodypart2, null);

            //when
            target.RemoveBodyPartThatWasInjured(bodypart2, null);

            Assert.AreEqual(1, target.AccidentRecordBodyParts.Count);
            Assert.IsTrue(target.AccidentRecordBodyParts.All(x => x.BodyPart.Id != bodypart2.Id));
        }
Пример #19
0
	/*
	 * Find the tip for a limb using the supplied info
	 * */
	public static BodyPart FindLimbTip(BodyPart tipParent, Component[] hierarchy, string tipName)
	{
		// if the tip parent is null, early out
		if (tipParent==null) return null;
		
		// the part that will be returned
		BodyPart ret = null;
		
		// if there is more than one child, find the middle digit using the naming convention
		if (tipParent.bone.childCount>1)
		{
			// search for children with the matching name
			ArrayList children = new ArrayList();
			int matches = 0;
			foreach (Transform child in tipParent.bone)
			{
				children.Add(child.name);
				if (child.name.Contains(tipName)) matches++;				
			}
			if (matches==1)
			{
				foreach (Transform child in tipParent.bone)
				{
					if (child.name.Length<tipName.Length || ret!=null) continue;
					if (child.name.Substring(0, tipName.Length) == tipName)
						ret = BipedHelpers.AddPartByName(child.name, hierarchy);
				}
			}
			
			// if no match was found, this may be a Max Biped, in which case the digits are numbered
			if (ret==null)
			{
				Transform tip = TransformHelpers.GetTransformInHierarchy(hierarchy, tipName+(tipParent.bone.childCount/2).ToString());
				if (tip!=null) ret = BipedHelpers.AddPartByName(tip.name, hierarchy);
			}
		}
		
		// couldn't find the middle digit, so pick the first child
		if (ret==null && tipParent.bone.childCount>0)
		{
			ret = BipedHelpers.AddPartByName(tipParent.bone.GetChild(0).name, hierarchy);
		}
		
		return ret;
	}
Пример #20
0
        public void MakeRound(BodyPart attackPoint, BodyPart blockPoint)
        {
            if (human.Hp <= 0 || npc.Hp <= 0)
            {
                return;
            }

            human.AttackPoint = attackPoint;
            human.BlockPoint = blockPoint;
            npc.AttackPoint = GenRandPart();
            npc.BlockPoint = GenRandPart();

            human.GetHit(npc.AttackPoint, npc.Name);
            npc.GetHit(human.AttackPoint, human.Name);

            if (human.Hp <= 0 && npc.Hp <= 0)
            {
                if (Draw != null)
                {
                    Draw(human, npc.Name);
                }
            }
            else if (human.Hp <= 0)
            {
                if (Dead != null)
                {
                    Dead(human, npc.Name);
                }
                if (Lose != null)
                {
                    Lose(human, npc.Name);
                }
            }
            else if (npc.Hp <= 0)
            {
                if (Dead != null)
                {
                    Dead(npc, human.Name);
                }
                if (Win != null)
                {
                    Win(human, npc.Name);
                }
            }
        }
Пример #21
0
    public Aspects.Secondary? getAspect(BodyPart bodyPart, Sprite sprite)
    {
        if (sprite == null) return null;

        foreach (Aspects.Secondary aspect in Enum.GetValues(typeof(Aspects.Secondary)))
        {
            if (!sprites.ContainsKey(aspect) || !sprites[aspect].ContainsKey(bodyPart))
            {
                //Debug.Log("No entry for part " + bodyPart + " and aspect " + aspect);
            }
            else
            {
                if (sprites[aspect][bodyPart] == sprite) return aspect;
            }
        }

        return null;
    }
Пример #22
0
 public static LokiUtil.LokiZone GetMappedZone(BodyPart part)
 {
   switch (part)
   {
     case BodyPart.Trunk:
       return LokiUtil.LokiManager.Zone2;
     case BodyPart.YellowEar:
       return LokiUtil.LokiManager.Zone4;
     case BodyPart.GreenEar:
       return LokiUtil.LokiManager.Zone6;
     case BodyPart.BlueHand:
       return LokiUtil.LokiManager.Zone7;
     case BodyPart.GreenHand:
       return LokiUtil.LokiManager.Zone9;
     case BodyPart.Belly:
     default:
       return LokiUtil.LokiManager.Zone8;
   }
 }
Пример #23
0
 public void SomethingHappenedToBodyPart(BodyPart bodyPart)
 {
     if (bodyPart is Ear)
     {
       string heardSounds = ((Ear)bodyPart).GetSounds();
       if (heardSounds.Contains("stupid"))
       {
       // Атакуємо образника
         Leg.StepForward();
         Hand.HitPersonNearYou();
         Leg.Kick();
       }
       else if (heardSounds.Contains("cool"))
       {
         Face.Smile();
       }
     }
     else if (bodyPart is Eye)
     {
     // Мозок може проаналізувати, що ви бачите і
     // прореагувати відповідно, використовуючи різні частини тіла
     }
     else if (bodyPart is Hand)
     {
       var hand = (Hand)bodyPart;
       bool hurtingFeeling = hand.DoesItHurt();
       if (hurtingFeeling)
       {
         Leg.StepBack();
       }
       bool itIsNice = hand.IsItNice();
       if (itIsNice)
       {
         Leg.StepForward();
         Hand.Embrace();
       }
     }
     else if (bodyPart is Leg)
     {
     // Якщо на ногу впаде цегла, змінюємо вираз обличчя 
     }
 }
Пример #24
0
 public void Reposition(BodyPart bodyPart)
 {
     switch (bodyPart) {
         case BodyPart.head:
             transform.localPosition = headTargetPosition;
             break;
         case BodyPart.leftArm:
             transform.localPosition = leftArmTargetPosition;
             break;
         case BodyPart.rightArm:
             transform.localPosition = rightArmTargetPosition;
             break;
         case BodyPart.leftLeg:
             transform.localPosition = leftLegTargetPosition;
             break;
         case BodyPart.rightLeg:
             transform.localPosition = rightLegTargetPosition;
             break;
     }
 }
Пример #25
0
    public bool Hit(float hitValue, BodyPart bodyPart)
    {
        HP -= hitValue;

        HP = Mathf.Clamp(HP, 0.0f, 100.0f);

        //		Debug.LogWarning(this.gameObject.name + " health left " + HP.ToString());

        if (HP == 0)
        {
            Dead();
            //Is alive? False
            return false;
        }
        else
        {
            //Is alive? True
            return true;
        }
    }
Пример #26
0
 private Material GetMat(BodyPart part)
 {
     
     switch (part)
     {
         case BodyPart.HAIR:
             return hair;
         case BodyPart.EYES:
             return eyes;
         case BodyPart.CLOTHES:
             return clothes;
         case BodyPart.EQUIPMENT:
             return equipment;
         case BodyPart.SKIN:
             return skin;
         case BodyPart.BEAM:
             return beam;
         default: return null;
     }
 }
Пример #27
0
 private void WritePartInfo(BodyPart part, StreamWriter writer)
 {
     switch (part)
     {
         case BodyPart.Head:
             writer.WriteLine("the head is hairy");
             break;
         case BodyPart.Shoulders:
             writer.WriteLine("the shoulders are broad");
             break;
         case BodyPart.Knees:
             writer.WriteLine("the knees are knobby");
             break;
         case BodyPart.Toes:
             writer.WriteLine("the toes are teeny");
             break;
         default:
             writer.WriteLine("some unknown part is unknown");
             break;
     }
 }
Пример #28
0
        public List<Message> MakeRound(BodyPart attackPoint, BodyPart blockPoint)
        {
            Log.Clear();

            if (Human.Hp <= 0 || Npc.Hp <= 0)
            {
                return Log;
            }

            if (Human.IsHumanAttacker)
            {
                HumanAttack(attackPoint);
                HumanBlock(blockPoint);
                Human.IsHumanAttacker = false;
            }
            else
            {
                HumanBlock(blockPoint);
                HumanAttack(attackPoint);
                Human.IsHumanAttacker = true;
            }

            if (Human.Hp <= 0 && Npc.Hp <= 0)
            {
                Log.Add(new Message(RoundAction.draw, DateTime.Now));
            }
            else if (Human.Hp <= 0)
            {
                Log.Add(new Message(RoundAction.dead, DateTime.Now, Human.Name));
                Log.Add(new Message(RoundAction.win, DateTime.Now, Npc.Name));
                GetPrize(Npc);
            }
            else if (Npc.Hp <= 0)
            {
                Log.Add(new Message(RoundAction.dead, DateTime.Now, Npc.Name));
                Log.Add(new Message(RoundAction.win, DateTime.Now, Human.Name));
                GetPrize(Human);
            }
            return Log;
        }
Пример #29
0
 /// <summary>
 /// Sets the rgb color of a specific part of this instance of the character.
 /// </summary>
 /// <param name="part">The part of the character you wish to edit</param>
 /// <param name="col">The color to which the part will be set</param>
 public void SetColor(BodyPart part, Color col)
 {
     if (part == BodyPart.BEAM)
     {
         if (LockedIn) return;
         float hue = 0f;
         float sat = 0f;
         float val = 0f;
         
         Vector3 hsv = RGBtoHSV(col);
         hue = hsv[0];
         sat = hsv[1];
         val = hsv[2];
         Color rgbHDR = HSVToRGB(hue, 0.7720589f, 5f, true);
         beam.SetColor("_EmissionColor", rgbHDR);
         beamCap.SetColor("_EmissionColor", rgbHDR);
         light.color = col;
     }
     else {
         GetMat(part).color = col;
     }
 }
Пример #30
0
        protected void ApplyDamage(Entity damager, int damageamount, DamageType damType, BodyPart targetLocation)
        {
            DamagedBy(damager, damageamount, damType);

            int actualDamage = Math.Max(damageamount - GetArmor(damType), 0);

            if (GetHealth() - actualDamage < 0) //No negative total health.
                actualDamage = (int) GetHealth();

            if (damageZones.Exists(x => x.location == targetLocation))
            {
                DamageLocation dmgLoc = damageZones.First(x => x.location == targetLocation);
                dmgLoc.AddDamage(damType, actualDamage);
            }

            if (targetLocation == BodyPart.Head && actualDamage > 5)
            {
                ComponentReplyMessage r = Owner.SendMessage(this, ComponentFamily.Actor,
                                                            ComponentMessageType.GetActorSession);
                if (r.MessageType == ComponentMessageType.ReturnActorSession)
                {
                    var s = (IPlayerSession) r.ParamsList[0];
                    s.AddPostProcessingEffect(PostProcessingEffectType.Blur, 5);
                }
            }

            TriggerBleeding(damageamount, damType, targetLocation);

            currentHealth = GetHealth();
            maxHealth = GetMaxHealth();

            SendHealthUpdate();

            if (GetHealth() <= 0)
            {
                Die();
            }
        }
Пример #31
0
 public static List <BodyPart> GetFlags(BodyPart bodyParts)
 {
     return(Enum.GetValues(typeof(BodyPart)).Cast <BodyPart>().Where(p => bodyParts.HasFlag(p)).ToList());
 }
Пример #32
0
 public void SetBlock(BodyPart bodyPart)
 {
     Blocked = bodyPart;
 }
Пример #33
0
 //kicks off recursive process for finding target bodypart
 public bool IsConnectedToBodyPartStarter(BodyPart targetBodypart)
 {
     return(IsConnectedToBodyPart(this, targetBodypart, new List <BodyPart>()));
 }
Пример #34
0
 private static void ReportDismemberment(Agent victim, BodyPart bodyPart)
 {
     //string word = bodyPart == BodyPart.Head ? "Decapitated" : "Dismembered";
     InformationManager.DisplayMessage(new InformationMessage($"Decapitated {victim.Character.Name}!", Colors.Red));
 }
Пример #35
0
        /// <summary>
        /// Calculates the player damage for a physical monster attack
        /// </summary>
        /// <param name="bodyPart">The player body part the monster is targeting</param>
        /// <param name="criticalHit">Is TRUE if monster rolls a critical hit</param>
        public float CalculateDamage(ref DamageType damageType, CombatManeuver maneuver, BodyPart bodyPart, ref bool criticalHit, ref float shieldMod)
        {
            // evasion chance
            var evadeChance = GetEvadeChance();

            if (Physics.Common.Random.RollDice(0.0f, 1.0f) < evadeChance)
            {
                return(0.0f);
            }

            // get base damage
            var attackPart = GetAttackPart(maneuver);

            damageType = GetDamageType(attackPart);
            var damageRange = GetBaseDamage(attackPart);
            var baseDamage  = Physics.Common.Random.RollDice(damageRange.Min, damageRange.Max);

            var damageRatingMod = GetRatingMod(EnchantmentManager.GetDamageRating());

            var player          = AttackTarget as Player;
            var recklessnessMod = player != null?player.GetRecklessnessMod() : 1.0f;

            // monster weapon / attributes
            var weapon = GetEquippedWeapon();

            // critical hit
            var critical = 0.1f;

            if (Physics.Common.Random.RollDice(0.0f, 1.0f) < critical)
            {
                criticalHit = true;
            }

            // attribute damage modifier (verify)
            var attributeMod = GetAttributeMod(AttackType.Melee);

            // get armor piece
            var armor = GetArmor(bodyPart);

            // get armor modifiers
            var armorMod = GetArmorMod(armor, damageType);

            // get resistance modifiers (protect/vuln)
            var resistanceMod = AttackTarget.EnchantmentManager.GetResistanceMod(damageType);

            var damageResistRatingMod = GetNegativeRatingMod(AttackTarget.EnchantmentManager.GetDamageResistRating());

            // get shield modifier
            var attackTarget = AttackTarget as Creature;

            shieldMod = attackTarget.GetShieldMod(this, damageType);

            // scale damage by modifiers
            var damage = baseDamage * damageRatingMod * attributeMod * armorMod * shieldMod * resistanceMod * damageResistRatingMod;

            if (!criticalHit)
            {
                damage *= recklessnessMod;
            }
            else
            {
                damage *= 2;    // fixme: target recklessness mod still in effect?
            }
            return(damage);
        }
Пример #36
0
 public void GetBodyPartSize(BodyPart part)
 {
     throw new NotImplementedException();
 }
Пример #37
0
    public override int ApplyDamage(int damage = 0, string damagetype = DamageType.BRUTE, string def_zone = null, int blocked = 0)
    {
        // TODO Blocking
        if (damage == 0)
        {
            return(0);
        }

        BodyPart BP = null;

        BP = GetBodyPart(def_zone);

        if (BodyPart.IsLimb(def_zone))
        {
            BP = GetBodyPart(def_zone);
        }
        else
        {
            if (def_zone == null)
            {
                def_zone = RandomiseZone(def_zone);
            }

            BP = GetBodyPart(def_zone);

            if (BP == null)
            {
                BP = BodyParts.First().GetComponent <BodyPart>();
            }
        }

        switch (damagetype)
        {
        case DamageType.BRUTE:
            if (BP != null)
            {
                if (BP.ReceiveDamage <Carbon>(damage, 0) == true)
                {
                    UpdateDamageOverlays();
                }      //no bodypart, we deal damage with a more general method.
                else
                {
                    AdjustBruteLoss(damage);
                }
            }
            break;

        case DamageType.BURN:
            if (BP.ReceiveDamage <Carbon>(0, damage) == true)
            {
                UpdateDamageOverlays();
            }      //no bodypart, we deal damage with a more general method.
            else
            {
                AdjustFireLoss(damage);
            }
            break;

        case DamageType.TOX:
            // AdjustToxLoss
            break;

        case DamageType.OXY:
            // AdjustOxyLoss
            break;

        case DamageType.CLONE:
            // AdjustCloneLoss
            break;

        case DamageType.STAMINA:
            // AdjustStaminaLoss
            break;
        }

        return(1);
    }
Пример #38
0
 public override void MakeBlock(BodyPart part)
 {
     Blocked = ((BodyPart)random.Next((int)BodyPart.Head, (int)BodyPart.Legs + 1));
     Block(this, new EventArgsBlock(Blocked));
 }
Пример #39
0
 public void EvolveSludge()
 {
     if (this.newLiquid != (byte)99)
     {
         Mutations part1 = this.ParentObject.GetPart("Mutations") as Mutations;
         if (!part1.HasMutation("LiquidSpitter"))
         {
             part1.AddMutation((BaseMutation) new LiquidSpitter(LiquidVolume.ComponentLiquidTypes[this.newLiquid].GetName((LiquidVolume)null).Substring(2)), 1);
         }
         LiquidSpitter mutation = part1.GetMutation("LiquidSpitter") as LiquidSpitter;
         mutation.extraLiquids.Add(this.newLiquid);
         if (mutation.extraLiquids.Count == 1 && this.newLiquid == (byte)18)
         {
             mutation.extraLiquids.Add((byte)0);
         }
         this.ComponentLiquids.Add(this.newLiquid);
         string displayName = this.ParentObject.DisplayName;
         this.ParentObject.DisplayName = string.Empty;
         foreach (byte componentLiquid in this.ComponentLiquids)
         {
             GameObject parentObject = this.ParentObject;
             parentObject.DisplayName = parentObject.DisplayName + LiquidVolume.ComponentLiquidTypes[componentLiquid].GetAdjective((LiquidVolume)null) + "&y ";
         }
         GameObject parentObject1 = this.ParentObject;
         parentObject1.DisplayName = parentObject1.DisplayName + Evolution.GetPrefix(this.ComponentLiquids.Count) + "sludge";
         if (this.ComponentLiquids.Count >= 5)
         {
             JournalAPI.AddAccomplishment("You witnessed the rare formation of " + Grammar.A(Evolution.GetPrefix(this.ComponentLiquids.Count) + "sludge", false) + ".", "general", (string)null, -1L);
         }
         MessageQueue.AddPlayerMessage("The " + LiquidVolume.ComponentLiquidTypes[this.newLiquid].GetName((LiquidVolume)null) + " &ycatalyzes " + this.ParentObject.the + displayName + " into " + this.ParentObject.a + this.ParentObject.DisplayName + ".");
         bool flag  = false;
         Body part2 = this.ParentObject.GetPart <Body>();
         foreach (BodyPart bodyPart in part2.GetPart("Hand"))
         {
             if (bodyPart.Equipped == null)
             {
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             this.totalHands += 2;
             BodyPart body        = part2.GetBody();
             BodyPart InsertAfter = body.AddPartAt("Pseudopod", 0, (string)null, (string)null, (string)null, (string)null, new int?(), new int?(), new int?(), new bool?(), new bool?(), new bool?(), new bool?(), new bool?(), "Hand", "Missile Weapon");
             body.AddPartAt(InsertAfter, "Pseudopod", 0, (string)null, (string)null, (string)null, (string)null, new int?(), new int?(), new int?(), new bool?(), new bool?(), new bool?(), new bool?(), new bool?());
         }
         if (this.newLiquid == (byte)0)
         {
             this.ParentObject.TakeObject("Watery Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)1)
         {
             this.ParentObject.TakeObject("Salty Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)2)
         {
             this.ParentObject.TakeObject("Tarry Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)3)
         {
             this.ParentObject.TakeObject("Magmatic Pseudopod", false, new int?(0));
             this.ParentObject.Statistics["HeatResistance"].BaseValue += 100;
             this.ParentObject.pPhysics.Temperature = 1000;
         }
         else if (this.newLiquid == (byte)4)
         {
             this.ParentObject.TakeObject("Slimy Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)5)
         {
             this.ParentObject.TakeObject("Oily Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)6)
         {
             this.ParentObject.TakeObject("Bloody Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <LifeDrainOnHit>(new LifeDrainOnHit("15-20", 100), true);
         }
         else if (this.newLiquid == (byte)7)
         {
             this.ParentObject.TakeObject("Acidic Pseudopod", false, new int?(0));
             this.ParentObject.Statistics["AcidResistance"].BaseValue += 100;
         }
         else if (this.newLiquid == (byte)8)
         {
             this.ParentObject.TakeObject("Honeyed Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)9)
         {
             this.ParentObject.TakeObject("Lush Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)10)
         {
             this.ParentObject.TakeObject("Sludgy Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)11)
         {
             this.ParentObject.TakeObject("Gooey Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)12)
         {
             this.ParentObject.TakeObject("Putrid Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)13)
         {
             this.ParentObject.TakeObject("Unctuous Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)14)
         {
             this.ParentObject.TakeObject("Oozing Pseudopod2", false, new int?(0));
         }
         else if (this.newLiquid == (byte)15)
         {
             this.ParentObject.TakeObject("Spiced Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)16)
         {
             this.ParentObject.TakeObject("Luminous Pseudopod2", false, new int?(0));
             this.ParentObject.AddPart <LightSource>(new LightSource(), true);
             (this.ParentObject.GetPart("LightSource") as LightSource).Radius = 6;
             this.ParentObject.Statistics["ColdResistance"].BaseValue        += 100;
         }
         else if (this.newLiquid == (byte)17)
         {
             this.ParentObject.TakeObject("Neutronic Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)18)
         {
             this.ParentObject.TakeObject("Homogenized Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <CloneOnHit>(new CloneOnHit(), true);
         }
         else if (this.newLiquid == (byte)20)
         {
             this.ParentObject.TakeObject("Waxen Pseudopod", false, new int?(0));
         }
         else if (this.newLiquid == (byte)21)
         {
             this.ParentObject.TakeObject("Inky Pseudopod", false, new int?(0));
             this.ParentObject.AddPart <DisarmOnHit>(new DisarmOnHit(100), true);
         }
         else if (this.newLiquid == (byte)22)
         {
             this.ParentObject.TakeObject("Sugary Pseudopod", false, new int?(0));
         }
         this.ParentObject.pBrain.PerformReequip(false);
         this.newLiquid = (byte)99;
     }
     this.isCatalyzing = false;
     if (this.ComponentLiquids.Count != 1)
     {
         return;
     }
     MessageQueue.AddPlayerMessage("The reacting liquids congeal into a " + this.ParentObject.ShortDisplayName + ".");
     this.C.AddObject(this.ParentObject);
     XRLCore.Core.Game.ActionManager.AddActiveObject(this.ParentObject);
 }
Пример #40
0
 public HumanBoneInput(BodyPart part, Transform model, Transform bone)
 {
     Part  = part;
     Model = model;
     Bone  = bone;
 }
Пример #41
0
 public static void OnWeaponDamage(IntPtr playerPointer, IntPtr entityPointer,
                                   BaseObjectType entityType, uint weapon, ushort damage, Position shotOffset, BodyPart bodyPart)
 {
     _module.OnWeaponDamage(playerPointer, entityPointer, entityType, weapon, damage, shotOffset, bodyPart);
 }
Пример #42
0
        /// <summary>
        /// Calculates the creature damage for a physical monster attack
        /// </summary>
        /// <param name="bodyPart">The creature body part the monster is targeting</param>
        /// <param name="criticalHit">Is TRUE if monster rolls a critical hit</param>
        public float?CalculateDamage(ref DamageType damageType, CombatManeuver maneuver, BodyPart bodyPart, ref bool criticalHit, ref float shieldMod)
        {
            // check lifestone protection
            var player = AttackTarget as Player;

            if (player != null && player.UnderLifestoneProtection)
            {
                player.HandleLifestoneProtection();
                return(null);
            }

            // evasion chance
            var evadeChance = GetEvadeChance();

            if (ThreadSafeRandom.Next(0.0f, 1.0f) < evadeChance)
            {
                return(null);
            }

            // get base damage
            var attackPart = GetAttackPart(maneuver);

            if (attackPart == null)
            {
                return(0.0f);
            }

            damageType = GetDamageType(attackPart);
            var damageRange = GetBaseDamage(attackPart);
            var baseDamage  = ThreadSafeRandom.Next(damageRange.Min, damageRange.Max);

            var damageRatingMod = GetRatingMod(EnchantmentManager.GetDamageRating());
            //Console.WriteLine("Damage Rating: " + damageRatingMod);

            var recklessnessMod = player != null?player.GetRecklessnessMod() : 1.0f;

            var target    = AttackTarget as Creature;
            var targetPet = AttackTarget as CombatPet;

            // handle pet damage type
            var pet = this as CombatPet;

            if (pet != null)
            {
                damageType = pet.DamageType;
            }

            // monster weapon / attributes
            var weapon = GetEquippedWeapon();

            // critical hit
            var critical = 0.1f;

            if (ThreadSafeRandom.Next(0.0f, 1.0f) < critical)
            {
                if (player != null && player.AugmentationCriticalDefense > 0)
                {
                    var protChance = player.AugmentationCriticalDefense * 0.25f;
                    if (ThreadSafeRandom.Next(0.0f, 1.0f) > protChance)
                    {
                        criticalHit = true;
                    }
                }
                else
                {
                    criticalHit = true;
                }
            }

            // attribute damage modifier (verify)
            var attributeMod = GetAttributeMod(weapon);

            // get armor piece
            var armorLayers = GetArmorLayers(bodyPart);

            // get armor modifiers
            var armorMod = GetArmorMod(damageType, armorLayers, weapon);

            // get resistance modifiers (protect/vuln)
            var resistanceMod = AttackTarget.EnchantmentManager.GetResistanceMod(damageType);

            var damageResistRatingMod = GetNegativeRatingMod(AttackTarget.EnchantmentManager.GetDamageResistRating());

            // get shield modifier
            var attackTarget = AttackTarget as Creature;

            shieldMod = attackTarget.GetShieldMod(this, damageType);

            // scale damage by modifiers
            var damage = baseDamage * damageRatingMod * attributeMod * armorMod * shieldMod * resistanceMod * damageResistRatingMod;

            if (!criticalHit)
            {
                damage *= recklessnessMod;
            }
            else
            {
                damage *= 2;    // fixme: target recklessness mod still in effect?
            }
            return(damage);
        }
Пример #43
0
 public void DeleteBodyPart(BodyPart bodyPart)
 {
     bodyPart.shape.SetToNull();
     bodyPart.styleLayers.Clear();
 }
Пример #44
0
 public T this[BodyPart limb]
 {
     get => getValue(limb);
Пример #45
0
        private void btnRound_Click(object sender, EventArgs e)
        {
            lbLog.Items.Clear();
            string battleLog;

            lblNumbRound.Text = (i + 2).ToString();

            if (player.Hp != 0 && computer.Hp != 0)
            {
                if (i % 2 != 0)
                {
                    if (rbHead.Checked)
                    {
                        player.SetBlock(BodyPart.Head);
                    }
                    else if (rbBody.Checked)
                    {
                        player.SetBlock(BodyPart.Body);
                    }
                    else if (rbLegs.Checked)
                    {
                        player.SetBlock(BodyPart.Legs);
                    }

                    BodyPart compAttack = computer.AtackPlayer();

                    player.GetHit(compAttack);

                    progressBarHPPlayer1.Value = player.Hp;
                    progressBarHPPlayer2.Value = computer.Hp;

                    lblHPPlayer1.Text = player.Hp.ToString();
                    lblHPPlayer2.Text = computer.Hp.ToString();

                    if (player.Hp == 0)
                    {
                        DialogResult result = MessageBox.Show("Game over! \nYou lose :( \nDo you want to play again?", "", MessageBoxButtons.YesNo);

                        if (result == DialogResult.Yes)
                        {
                            log.Clear();

                            game.RemoveEvent(player, computer, log);

                            log = new Log();

                            player   = new Player(player.Name, 100);
                            computer = new Computer("Computer", 100);

                            progressBarHPPlayer1.Value = 100;
                            progressBarHPPlayer2.Value = 100;

                            lblHPPlayer1.Text = player.Hp.ToString();
                            lblHPPlayer2.Text = computer.Hp.ToString();

                            game.AddEvent(player, computer, log);

                            i = 0;

                            lblNumbRound.Text = (i + 1).ToString();
                        }
                        else
                        {
                            game.RemoveEvent(player, computer, log);
                            Close();
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        lblAction.Text = "Choose part of the body to attack";

                        i++;
                    }
                }
                else
                {
                    computer.BlockPart();

                    if (rbHead.Checked)
                    {
                        computer.GetHit(BodyPart.Head);
                    }
                    else if (rbBody.Checked)
                    {
                        computer.GetHit(BodyPart.Body);
                    }
                    else if (rbLegs.Checked)
                    {
                        computer.GetHit(BodyPart.Legs);
                    }

                    progressBarHPPlayer1.Value = player.Hp;
                    progressBarHPPlayer2.Value = computer.Hp;

                    if (computer.Hp == 0)
                    {
                        DialogResult result = MessageBox.Show("Game over! \n You win :) \n Do you want to play again?", "", MessageBoxButtons.YesNo);
                        if (result == DialogResult.Yes)
                        {
                            game.RemoveEvent(player, computer, log);

                            log.Clear();

                            log = new Log();

                            player   = new Player(player.Name, 100);
                            computer = new Computer("Computer", 100);
                            progressBarHPPlayer1.Value = 100;
                            progressBarHPPlayer2.Value = 100;

                            lblHPPlayer1.Text = player.Hp.ToString();
                            lblHPPlayer2.Text = computer.Hp.ToString();

                            game.AddEvent(player, computer, log);

                            i = 0;

                            lblNumbRound.Text = (i + 1).ToString();
                        }
                        else
                        {
                            game.RemoveEvent(player, computer, log);
                            Close();
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        lblAction.Text = "Choose part of the body to protect";

                        i++;
                    }
                }
            }
            battleLog = log.ToString();
            UpdateLB(battleLog);
        }
Пример #46
0
 public BodyPartRemovedEventArgs(BodyPart part, string slotName)
 {
     Part     = part;
     SlotName = slotName;
 }
        internal override void CreateBody()
        {
            Attack bite = new Attack()
            {
                name = "Bite", attack_damage = 5, effect = EffectTypes.ZombieEffect
            };
            BodyPart mouth = new BodyPart()
            {
                name = "Mouth", attack = bite, hitPoints = 2, maxHitPoints = 2
            };

            Owner.body.bodyparts.Add("Mouth", mouth);

            BodyPart face = new BodyPart()
            {
                name = "Face", maxHitPoints = 2, hitPoints = 2
            };

            Owner.body.bodyparts.Add("Face", face);

            BodyPart brain = new BodyPart()
            {
                name = "Brain", maxHitPoints = 2, hitPoints = 2
            };

            Owner.body.bodyparts.Add("Brain", brain);


            BodyPart neck = new BodyPart()
            {
                name = "Neck", maxHitPoints = 2, hitPoints = 2
            };

            Owner.body.bodyparts.Add("Neck", neck);


            BodyPart left_arm = new BodyPart()
            {
                name = "Left arm", maxHitPoints = 2, hitPoints = 2
            };

            Owner.body.bodyparts.Add("Left arm", left_arm);

            BodyPart right_arm = new BodyPart()
            {
                name = "Right arm", maxHitPoints = 2, hitPoints = 2
            };

            Owner.body.bodyparts.Add("Right arm", right_arm);


            BodyPart left_foot = new BodyPart()
            {
                name = "Left foot", maxHitPoints = 2, hitPoints = 2, mobility = true
            };

            Owner.body.bodyparts.Add("Left foot", left_foot);

            BodyPart right_foot = new BodyPart()
            {
                name = "Right foot", maxHitPoints = 2, hitPoints = 2, mobility = true
            };

            Owner.body.bodyparts.Add("Right foot", right_foot);
        }
Пример #48
0
 public void DamagePlayer(BodyPart part)
 {
     player.GetHit(part);
 }
Пример #49
0
        public static BodyPart BodyPartCopy(BodyPart origin, GameObject Parent, Body NewBody)
        {
            if (origin == null || NewBody == null || Parent == null)
            {
                return(null);
            }
            BodyPart bodyPart = new BodyPart(NewBody);

            bodyPart.Type                       = origin.Type;
            bodyPart.VariantType                = origin.VariantType;
            bodyPart.Description                = origin.Description;
            bodyPart.Name                       = origin.Name;
            bodyPart.SupportsDependent          = origin.SupportsDependent;
            bodyPart.DependsOn                  = origin.DependsOn;
            bodyPart.RequiresType               = origin.RequiresType;
            bodyPart.PreventRegenerationBecause = origin.PreventRegenerationBecause;
            bodyPart.Category                   = origin.Category;
            bodyPart.Laterality                 = origin.Laterality;
            bodyPart.RequiresLaterality         = origin.RequiresLaterality;
            bodyPart.Mobility                   = origin.Mobility;
            bodyPart.Primary                    = origin.Primary;
            bodyPart.Native                     = origin.Native;
            bodyPart.Integral                   = origin.Integral;
            bodyPart.Mortal                     = origin.Mortal;
            bodyPart.Abstract                   = origin.Abstract;
            bodyPart.Extrinsic                  = origin.Extrinsic;
            bodyPart.Plural                     = origin.Plural;
            bodyPart.Position                   = origin.Position;
            bodyPart._ID        = origin._ID;
            bodyPart.ParentBody = NewBody;
            // if (DefaultBehavior != null)
            // {
            //  GameObject gameObject = DefaultBehavior.DeepCopy();
            //  Parent.DeepCopyInventoryObjectMap.Add(DefaultBehavior, gameObject);
            //  gameObject.pPhysics._Equipped = Parent;
            //  bodyPart.DefaultBehavior = gameObject;
            // }
            // if (Equipped != null && !Parent.DeepCopyInventoryObjectMap.ContainsKey(Equipped))
            // {
            //  GameObject gameObject2 = Equipped.DeepCopy();
            //  Parent.DeepCopyInventoryObjectMap.Add(Equipped, gameObject2);
            //  Body.DeepCopyEquipMap.Add(gameObject2, bodyPart);
            // }
            if (origin.Parts == null)
            {
                return(bodyPart);
            }
            if (bodyPart.Parts == null)
            {
                bodyPart.Parts = new List <BodyPart>(13);
            }
            foreach (BodyPart part in origin.Parts)
            {
                if (!part.Extrinsic)
                {
                    BodyPart copy = BodyPartCopy(part, Parent, NewBody);
                    if (copy != null)
                    {
                        bodyPart.AddPart(copy);
                    }
                }
            }
            return(bodyPart);
        }
Пример #50
0
 public void DamageEnemy(BodyPart part)
 {
     enemy.GetHit(part);
 }
Пример #51
0
        // TODO
        //		public static int get_bodypart_from_item(int nItemID, int nGender, int* pnBodyPart, int bAll)
        //		{
        //			int v4; // eax
        //			int result; // eax
        //			int v6; // ecx
        //			int v7; // eax

        //			v4 = get_gender_from_id(nItemID);
        //			if (nGender != 2 && v4 != 2 && v4 != nGender)
        //				return 0;
        //			v6 = nItemID / 10000;
        //			switch (nItemID / 10000)
        //			{
        //				case 100:
        //					*pnBodyPart = 1;
        //					result = 1;
        //					break;
        //				case 101:
        //					*pnBodyPart = 2;
        //					result = 1;
        //					break;
        //				case 102:
        //					*pnBodyPart = 3;
        //					result = 1;
        //					break;
        //				case 103:
        //					*pnBodyPart = 4;
        //					result = 1;
        //					break;
        //				case 104:
        //				case 105:
        //					*pnBodyPart = 5;
        //					result = 1;
        //					break;
        //				case 106:
        //					*pnBodyPart = 6;
        //					result = 1;
        //					break;
        //				case 107:
        //					*pnBodyPart = 7;
        //					result = 1;
        //					break;
        //				case 108:
        //					*pnBodyPart = 8;
        //					result = 1;
        //					break;
        //				case 109:
        //				case 119:
        //				case 134:
        //					*pnBodyPart = 10;
        //					result = 1;
        //					break;
        //				case 110:
        //					*pnBodyPart = 9;
        //					result = 1;
        //					break;
        //				case 111:
        //					if (bAll)
        //					{
        //						*pnBodyPart = 12;
        //						pnBodyPart[1] = 13;
        //						pnBodyPart[2] = 15;
        //						pnBodyPart[3] = 16;
        //						result = 4;
        //					}
        //					else
        //					{
        //						*pnBodyPart = 12;
        //						result = 1;
        //					}
        //					break;
        //				case 112:
        //					*pnBodyPart = 17;
        //					if (!bAll)
        //						goto LABEL_71;
        //					pnBodyPart[1] = 59;
        //					result = 2;
        //					break;
        //				case 113:
        //					*pnBodyPart = 50;
        //					result = 1;
        //					break;
        //				case 114:
        //					*pnBodyPart = 49;
        //					result = 1;
        //					break;
        //				case 115:
        //					*pnBodyPart = 51;
        //					result = 1;
        //					break;
        //				case 161:
        //					*pnBodyPart = 1100;
        //					result = 1;
        //					break;
        //				case 162:
        //					*pnBodyPart = 1101;
        //					result = 1;
        //					break;
        //				case 163:
        //					*pnBodyPart = 1102;
        //					result = 1;
        //					break;
        //				case 164:
        //					*pnBodyPart = 1103;
        //					result = 1;
        //					break;
        //				case 165:
        //					*pnBodyPart = 1104;
        //					result = 1;
        //					break;
        //				case 180:
        //					if (nItemID == 1802100)
        //					{
        //						if (bAll)
        //							goto LABEL_39;
        //						*pnBodyPart = 21;
        //						result = 1;
        //					}
        //					else if (bAll)
        //					{
        //						*pnBodyPart = 14;
        //						pnBodyPart[1] = 30;
        //						pnBodyPart[2] = 38;
        //						result = 3;
        //					}
        //					else
        //					{
        //						*pnBodyPart = 14;
        //						result = 1;
        //					}
        //					break;
        //				case 181:
        //					switch (nItemID)
        //					{
        //						case 1812000:
        //							*pnBodyPart = 23;
        //							if (!bAll)
        //								goto LABEL_71;
        //							pnBodyPart[1] = 34;
        //							pnBodyPart[2] = 42;
        //							result = 3;
        //							break;
        //						case 1812001:
        //							if (bAll)
        //							{
        //								*pnBodyPart = 22;
        //								pnBodyPart[1] = 33;
        //								pnBodyPart[2] = 41;
        //								result = 3;
        //							}
        //							else
        //							{
        //								*pnBodyPart = 22;
        //								result = 1;
        //							}
        //							break;
        //						case 1812002:
        //							*pnBodyPart = 24;
        //							result = 1;
        //							break;
        //						case 1812003:
        //							*pnBodyPart = 25;
        //							result = 1;
        //							break;
        //						case 1812004:
        //							if (bAll)
        //							{
        //								*pnBodyPart = 26;
        //								pnBodyPart[1] = 35;
        //								pnBodyPart[2] = 43;
        //								result = 3;
        //							}
        //							else
        //							{
        //								*pnBodyPart = 26;
        //								result = 1;
        //							}
        //							break;
        //						case 1812005:
        //							if (bAll)
        //							{
        //								*pnBodyPart = 27;
        //								pnBodyPart[1] = 36;
        //								pnBodyPart[2] = 44;
        //								result = 3;
        //							}
        //							else
        //							{
        //								*pnBodyPart = 27;
        //								result = 1;
        //							}
        //							break;
        //						case 1812006:
        //							*pnBodyPart = 28;
        //							if (!bAll)
        //								goto LABEL_71;
        //							pnBodyPart[1] = 37;
        //							pnBodyPart[2] = 45;
        //							result = 3;
        //							break;
        //						case 1812007:
        //							if (bAll)
        //							{
        //								*pnBodyPart = 46;
        //								pnBodyPart[1] = 47;
        //								pnBodyPart[3] = 48;
        //								result = 3;
        //							}
        //							else
        //							{
        //								*pnBodyPart = 46;
        //								result = 1;
        //							}
        //							break;
        //						default:
        //							goto $LN10_10;
        //					}
        //					break;
        //				case 182:
        //$LN10_10:
        //					if (bAll)
        //					{
        //					LABEL_39:
        //						*pnBodyPart = 21;
        //						pnBodyPart[1] = 31;
        //						pnBodyPart[2] = 39;
        //						result = 3;
        //					}
        //					else
        //					{
        //						*pnBodyPart = 21;
        //						result = 1;
        //					}
        //					break;
        //				case 183:
        //					*pnBodyPart = 29;
        //					if (!bAll)
        //						goto LABEL_71;
        //					pnBodyPart[1] = 32;
        //					pnBodyPart[2] = 40;
        //					result = 3;
        //					break;
        //				case 190:
        //					*pnBodyPart = 18;
        //					result = 1;
        //					break;
        //				case 191:
        //					*pnBodyPart = 19;
        //					result = 1;
        //					break;
        //				case 192:
        //					*pnBodyPart = 20;
        //					result = 1;
        //					break;
        //				case 194:
        //					*pnBodyPart = 1000;
        //					result = 1;
        //					break;
        //				case 195:
        //					*pnBodyPart = 1001;
        //					result = 1;
        //					break;
        //				case 196:
        //					*pnBodyPart = 1002;
        //					result = 1;
        //					break;
        //				case 197:
        //					*pnBodyPart = 1003;
        //					result = 1;
        //					break;
        //				default:
        //					v7 = v6 / 10;
        //					if (v6 / 10 != 13 && v7 != 14 && v7 != 16 && v7 != 17)
        //						return 0;
        //					*pnBodyPart = 11;
        //				LABEL_71:
        //					result = 1;
        //					break;
        //			}
        //			return result;
        //		}

        public static bool is_correct_bodypart(int nItemID, BodyPart nBodyPart)
        {
            var v5 = nItemID / 10000;

            switch (v5)
            {
            case 100:
                return(nBodyPart == BodyPart.BP_CAP);

            case 101:
                return(nBodyPart == BodyPart.BP_FACEACC);

            case 102:
                return(nBodyPart == BodyPart.BP_EYEACC);

            case 103:
                return(nBodyPart == BodyPart.BP_EARACC);

            case 104:
            case 105:
                return(nBodyPart == BodyPart.BP_CLOTHES);

            case 106:
                return(nBodyPart == BodyPart.BP_PANTS);

            case 107:
                return(nBodyPart == BodyPart.BP_SHOES);

            case 108:
                return(nBodyPart == BodyPart.BP_GLOVES);

            case 109:
            case 119:
            case 134:
                return(nBodyPart == BodyPart.BP_SHIELD);

            case 110:
                return(nBodyPart == BodyPart.BP_CAPE);

            case 111:
                return(nBodyPart == BodyPart.BP_RING1 ||
                       nBodyPart == BodyPart.BP_RING2 ||
                       nBodyPart == BodyPart.BP_RING3 ||
                       nBodyPart == BodyPart.BP_RING4);

            case 112:
                return(nBodyPart == BodyPart.BP_PENDANT || nBodyPart == BodyPart.BP_EXT_PENDANT1);

            case 113:
                return(nBodyPart == BodyPart.BP_BELT);

            case 114:
                return(nBodyPart == BodyPart.BP_MEDAL);

            case 115:
                return(nBodyPart == BodyPart.BP_SHOULDER);

            case 161:
                return(nBodyPart == BodyPart.MP_BASE);                        // MECHANIC START

            case 162:
                return(nBodyPart == BodyPart.MP_ARM);

            case 163:
                return(nBodyPart == BodyPart.MP_LEG);

            case 164:
                return(nBodyPart == BodyPart.MP_FRAME);

            case 165:
                return(nBodyPart == BodyPart.MP_TRANSISTER);                        // MECHANIC END

            case 180:
                if (nItemID == 1802100)
                {
                    return(nBodyPart == BodyPart.BP_PETRING_LABEL ||
                           nBodyPart == BodyPart.BP_PETRING_LABEL2 ||
                           nBodyPart == BodyPart.BP_PETRING_LABEL3);
                }
                else
                {
                    return(nBodyPart == BodyPart.BP_PETWEAR ||
                           nBodyPart == BodyPart.BP_PETWEAR2 ||
                           nBodyPart == BodyPart.BP_PETWEAR3);
                }

            case 181:
                switch (nItemID)
                {
                case 1812000:
                    return(nBodyPart == BodyPart.BP_PETABIL_MESO ||
                           nBodyPart == BodyPart.BP_PETABIL_MESO2 ||
                           nBodyPart == BodyPart.BP_PETABIL_MESO3);

                case 1812001:
                    return(nBodyPart == BodyPart.BP_PETABIL_ITEM ||
                           nBodyPart == BodyPart.BP_PETABIL_ITEM2 ||
                           nBodyPart == BodyPart.BP_PETABIL_ITEM3);

                case 1812002:
                    return(nBodyPart == BodyPart.BP_PETABIL_HPCONSUME);

                case 1812003:
                    return(nBodyPart == BodyPart.BP_PETABIL_MPCONSUME);

                case 1812004:
                    return(nBodyPart == BodyPart.BP_PETABIL_SWEEPFORDROP ||
                           nBodyPart == BodyPart.BP_PETABIL_SWEEPFORDROP2 ||
                           nBodyPart == BodyPart.BP_PETABIL_SWEEPFORDROP3);

                case 1812005:
                    return(nBodyPart == BodyPart.BP_PETABIL_LONGRANGE ||
                           nBodyPart == BodyPart.BP_PETABIL_LONGRANGE2 ||
                           nBodyPart == BodyPart.BP_PETABIL_LONGRANGE3);

                case 1812006:
                    return(nBodyPart == BodyPart.BP_PETABIL_PICKUPOTHERS ||
                           nBodyPart == BodyPart.BP_PETABIL_PICKUPOTHERS2 ||
                           nBodyPart == BodyPart.BP_PETABIL_PICKUPOTHERS3);

                case 1812007:
                    return(nBodyPart == BodyPart.BP_PETABIL_IGNOREITEMS1 ||
                           nBodyPart == BodyPart.BP_PETABIL_IGNOREITEMS2 ||
                           nBodyPart == BodyPart.BP_PETABIL_IGNOREITEMS2);

                default:
                    return(false);
                }

            case 182:
                return(nBodyPart == BodyPart.BP_PETRING_LABEL ||
                       nBodyPart == BodyPart.BP_PETRING_LABEL2 ||
                       nBodyPart == BodyPart.BP_PETRING_LABEL3);

            case 183:
                return(nBodyPart == BodyPart.BP_PETRING_QUOTE ||
                       nBodyPart == BodyPart.BP_PETRING_QUOTE2 ||
                       nBodyPart == BodyPart.BP_PETRING_QUOTE3);

            case 190:
                return(nBodyPart == BodyPart.BP_TAMINGMOB);                        // MOUNT START

            case 191:
                return(nBodyPart == BodyPart.BP_SADDLE);

            case 192:
                return(nBodyPart == BodyPart.BP_MOBEQUIP);                        // MOUNT END

            case 194:
                return(nBodyPart == BodyPart.DP_BASE);                        // DRAGON START

            case 195:
                return(nBodyPart == BodyPart.DP_PENDANT);

            case 196:
                return(nBodyPart == BodyPart.DP_WING);

            case 197:
                return(nBodyPart == BodyPart.DP_SHOES);                        // DRAGON END

            default:
                var v7 = v5 / 10;

                if (v7 != 13 && v7 != 14 && v7 != 16 && v7 != 17)
                {
                    return(false);
                }

                return(nBodyPart == BodyPart.BP_WEAPON);
            }
        }
Пример #52
0
 public void BlockPlayer(BodyPart part)
 {
     player.SetBlock(part);
 }
Пример #53
0
        public static void WeaponDamage(PlayerModel player, PlayerModel target, uint weapon, ushort dmg, Position offset, BodyPart bodypart)
        {
            try
            {
                if (target == player || !Functions.WeaponModel.TeamDamage && target.Team == player.Team || target.EntityGodmode)
                {
                    return;
                }
                if (target.Health <= 0 || target.IsDead || player.Health <= 0 || player.IsDead)
                {
                    return;
                }
                if (Functions.AnticheatModel.CheckWeapons)
                {
                    if (!player.Weapons.Contains(weapon) && weapon != (uint)AltV.Net.Enums.WeaponModel.Fist && weapon != 0)
                    {
                        return;
                    }
                }

                if (Functions.WeaponModel.Headshot && bodypart == BodyPart.Head)
                {
                    target.Health = 0;
                    Alt.Emit("GlobalSystems:OnPlayerSyncDamage", target, player, 200);
                    return;
                }
                AltV.Net.Enums.WeaponModel ConvertedWeapon = (AltV.Net.Enums.WeaponModel)weapon;
                if (ConvertedWeapon == AltV.Net.Enums.WeaponModel.SniperRifle && bodypart == BodyPart.Head)
                {
                    if (Functions.WeaponModel.SniperHeadshotOneshot)
                    {
                        target.Health = 0;
                        Alt.Emit("GlobalSystems:OnPlayerSyncDamage", target, player, 200);
                        return;
                    }
                }
                if (ConvertedWeapon == AltV.Net.Enums.WeaponModel.RPG)
                {
                    target.Health -= 150;
                    return;
                }

                float Damage = GetWeaponDamage(ConvertedWeapon); // GetWeaponDamage
                Damage *= GetBoneDamageMul(bodypart);            //Damage * BoneMule
                if (target.Armor > 0)
                {
                    int Adiff = target.Armor - Convert.ToInt32(Damage);
                    if (Adiff <= 0)
                    {
                        target.Health += (ushort)Adiff; target.Armor = 0;
                    }
                    else
                    {
                        target.Armor -= (ushort)Damage;
                    }
                }
                else
                {
                    target.Health -= (ushort)Damage;
                }
                Alt.Emit("GlobalSystems:OnPlayerSyncDamage", target, player, Damage);
            }
            catch (Exception ex) { Core.Debug.CatchExceptions(ex); }
        }
Пример #54
0
 public void BlockEnemy(BodyPart part)
 {
     enemy.SetBlock(part);
 }
Пример #55
0
 /// <summary>
 /// Returns a body part for a player defender
 /// </summary>
 public void GetBodyPart(AttackHeight attackHeight)
 {
     // select random body part @ current attack height
     BodyPart = BodyParts.GetBodyPart(attackHeight);
 }
Пример #56
0
        public void Initializeaza(BLLUtile.StructMailKitInbox pMailInbox, IMailFolder pFolder, UniqueId pId, BodyPart pBodyPart)
        {
            base.InitializeazaVariabileleGenerale();

            incepeIncarcarea();
            this.lMailInbox = pMailInbox;

            this.txtDetaliiEcranFrom.Text    = lMailInbox.From.ToString();
            this.txtDetaliiEcranSubject.Text = lMailInbox.Subiect;
            this.txtDetaliiEcranTo.Text      = lMailInbox.To;
            this.lblDetaliiEmailDataOra.Text = lMailInbox.Data;

            ControlInbox.Render(pFolder, pId, pBodyPart, this.wbDetaliiEmail);


            finalizeazaIncarcarea();
        }
Пример #57
0
 public static void ApplyPetrificationCharm(BodyPart bodyPart, float seconds, int goldCost)
 {
     StaticCoroutine.Start(ApplyPetrificationCharmCoroutine(bodyPart, seconds, goldCost));
 }
Пример #58
0
 public static void WeaponDamage(PlayerModel player, PlayerModel target, uint weapon, ushort dmg, Position offset, BodyPart bodypart)
 {
     try { if (target == null)
           {
               return;
           }
           if (!Functions.AnticheatModel.AntiGodmode)
           {
               return;
           }
           WeaponSync.WeaponDamage(player, target, weapon, dmg, offset, bodypart); Alt.Emit("GlobalSystems:OnEntityHit", player, target); }
     catch (Exception ex) { Core.Debug.CatchExceptions("WeaponDamage", ex); }
 }
Пример #59
0
 public PlayerDamagedEventArgs(Player source, Element?damager, WeaponType weaponType, BodyPart bodyPart)
 {
     this.Source     = source;
     this.Damager    = damager;
     this.WeaponType = weaponType;
     this.BodyPart   = bodyPart;
 }
Пример #60
0
 /// <summary>
 /// Visit the abstract MIME body part.
 /// </summary>
 /// <remarks>
 /// Visits the abstract MIME body part.
 /// </remarks>
 /// <param name="entity">The MIME body part.</param>
 protected internal virtual void VisitBodyPart(BodyPart entity)
 {
 }