public ActorBody(Actor owner) { this.owner = owner; MaxHealth = Health = owner.Talents.GetTalent("attrb_constitution").As <AttributeComponent>().Rank; bodyParts = new Dictionary <BodySlot, BodyPart> { { BodySlot.Torso, new BodyPart("Torso", BodySlot.Torso, Health, 0) }, { BodySlot.Head, new BodyPart("Head", BodySlot.Head, Health, -World.STANDARD_DEVIATION * 5 / 3) }, { BodySlot.MainArm, new BodyPart("Right Arm", BodySlot.MainArm, Health / 2, -World.STANDARD_DEVIATION * 4 / 3) }, { BodySlot.OffArm, new BodyPart("Left Arm", BodySlot.OffArm, Health / 2, -World.STANDARD_DEVIATION * 4 / 3) }, { BodySlot.MainHand, new BodyPart("Main Hand", BodySlot.MainHand, Health / 3, -World.STANDARD_DEVIATION * 4 / 3) }, { BodySlot.OffHand, new BodyPart("Off Hand", BodySlot.OffHand, Health / 3, -World.STANDARD_DEVIATION * 4 / 3) }, { BodySlot.Leg, new BodyPart("Leg", BodySlot.Leg, Health / 2, -2) }, { BodySlot.Feet, new BodyPart("Feet", BodySlot.Feet, Health / 3, -4) } }; Punch = new MeleeComponent(null, new MeleeComponentTemplate { ComponentId = "punch", ActionDescription = "punch", ActionDescriptionPlural = "punches", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(-5), DamageType = Combat.DamageTypes["crush"], Penetration = 1, WeaponSpeed = 100, Reach = 0, Strength = 0, Parry = 0 }); }
public static void TestChaining() { var r0 = Rand.Constant(-3); var r1 = Rand.Dice(2, 4); var r2 = Rand.Range(2, 10); var r3 = Rand.Taper(1, 6); var r4 = Rand.Triangle(10, 7); var chain = r0 + r1 + r2 + r3 + r4; Parse("10t7 + (1:6) + 2-10 + 2d4 + -3", chain.ToString(), r0.Average + r1.Average + r2.Average + r3.Average + r4.Average); }
public void Init() { World = new World(); EntityManager = World.EntityManager; World.CurrentLevel = Level = new Level(new Size(5, 5), World, "Floor", new List <Terrain> { new Terrain("Floor", "Floor", true, true, 1.0), new Terrain("Wall", "Wall", false, false, 0.0) }); World.Player = Entity = EntityManager.Create(new List <Component> { new Sprite("player", Sprite.ActorLayer), BodyComponent.CreateHuman(50), new VisibleComponent(10), new SightComponent(), new MeleeComponent(new MeleeComponent.Template { ActionDescription = "punch", ActionDescriptionPlural = "punches", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(-5), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = World.OneSecondInSpeed, APToReady = 1, Reach = 0, Strength = 1, Parry = 0 }), new GameObject(2, 2, Level), new ItemContainerComponent(), new ControllerComponent(new Player(), new AP(World.OneSecondInSpeed)), new Creature(), new Identifier("Player"), new EquipmentComponent(new List <string> { "slot1", "slot2", "slot3", "slot4", }) }); }
public static void Init(EntityFactory ef) { ef.Add("person", new Sprite("npc", Sprite.ActorLayer), new Identifier("npc"), new ControllerComponent(new DoNothing(), new AP(World.OneSecondInSpeed / 2)), new Creature(), BodyComponent.CreateHuman(50), new VisibleComponent(10), new ItemContainerComponent(), new ConditionHolder(new HumanNeedsEffect(), new CreatureEncumbranceEffect()), new EquipmentComponent(new List <string> { "Head", "Torso", "Arms", "Main Hand", "Off Hand", "Hands", "Legs", "Feet" }), new SightComponent(), new MeleeComponent(new MeleeComponent.Template { ActionDescription = "punch", ActionDescriptionPlural = "punches", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(-5), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = World.OneSecondInSpeed, APToReady = 1, Reach = 0, Strength = 1, Parry = 0, })); ef.Inherits("npc", "person", new ControllerComponent(new NPC(), new AP(World.OneSecondInSpeed / 2))); ef.Inherits("player", "person", new Sprite("player", Sprite.PlayerLayer), new Identifier("Player"), new ControllerComponent(new Player(), new AP(World.OneSecondInSpeed / 2))); }
public BaseMeleeWeapon() : base("base_meleeweapon") { Add(new Sprite("WEAPON", Sprite.ItemsLayer)); Add(Equipable.SingleSlot("Main Hand", "Off Hand")); Add(new MeleeComponent( new MeleeComponent.Template { ActionDescription = "hit", ActionDescriptionPlural = "hits", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(-10), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 1, Parry = -3 })); }
public static void TestAddition() { var r = Rand.Constant(10) + Rand.Constant(10) + Rand.Constant(55); Assert.AreEqual(75, r.Roll()); }
public void SetUp() { Pistol = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), Equipable.SingleSlot("slot1", "slot2"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.None }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Constant(1), DamageType = SkrGame.Gameplay.Combat.Combat.DamageTypes["pierce"], Penetration = 1, Shots = 10, Range = 100, RoF = 1, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(1f), Recoil = 1, Reliability = 18, Strength = 8, AmmoCaliber = "pistol", OneInTheChamber = true, SwapClips = true, }) }); Revolver = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), Equipable.SingleSlot("slot1", "slot2"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.None }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Constant(1), DamageType = SkrGame.Gameplay.Combat.Combat.DamageTypes["pierce"], Penetration = 1, Shots = 10, Range = 100, RoF = 1, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(1f), Recoil = 1, Reliability = 18, Strength = 8, AmmoCaliber = "revolver", OneInTheChamber = false, SwapClips = false, }) }); Shotgun = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), Equipable.SingleSlot("slot3"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.None }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_shotgun", Accuracy = 2, Damage = Rand.Constant(1), DamageType = SkrGame.Gameplay.Combat.Combat.DamageTypes["pierce"], Penetration = 1, Shots = 10, Range = 100, RoF = 1, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(1f), Recoil = 1, Reliability = 18, Strength = 8, AmmoCaliber = "shotgun", OneInTheChamber = true, SwapClips = false, }) }); PistolAmmo = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), new ReferenceId("pistolammo"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.Hard }), new AmmoComponent( new AmmoComponent.Template { ActionDescription = "load", ActionDescriptionPlural = "loads", Caliber = "pistol", }) }); PistolAmmo.Get <Item>().Amount = 30; RevolverAmmo = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), new ReferenceId("revolverammo"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.Hard }), new AmmoComponent( new AmmoComponent.Template { ActionDescription = "load", ActionDescriptionPlural = "loads", Caliber = "revolver", }) }); RevolverAmmo.Get <Item>().Amount = 30; ShotgunAmmo = EntityManager.Create(new List <Component> { new GameObject(0, 0, Level), new ReferenceId("shotgunammo"), new Item( new Item.Template { Value = 30, Weight = 0, Size = 0, StackType = StackType.Hard }), new AmmoComponent( new AmmoComponent.Template { ActionDescription = "load", ActionDescriptionPlural = "loads", Caliber = "shotgun", }) }); ShotgunAmmo.Get <Item>().Amount = 30; new GetItemAction(Entity, PistolAmmo, 30).OnProcess(); new GetItemAction(Entity, RevolverAmmo, 30).OnProcess(); new GetItemAction(Entity, ShotgunAmmo, 30).OnProcess(); new EquipItemAction(Entity, Pistol, "slot1", true).OnProcess(); new EquipItemAction(Entity, Revolver, "slot2", true).OnProcess(); new EquipItemAction(Entity, Shotgun, "slot3", true).OnProcess(); }
private static void InitPistols(EntityFactory ef) { ef.Inherits("base_gun", "base_meleeweapon", new Sprite("GUN", Sprite.ItemsLayer), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Constant(1), DamageType = Combat.DamageTypes["pierce"], Penetration = 1, Shots = 1, Range = 100, RoF = 1, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(1f), Recoil = 1, Reliability = 18, Strength = 8, AmmoCaliber = "base_bullet", })); var pistolTemplate = new MeleeComponent.Template { ActionDescription = "pistol whip", ActionDescriptionPlural = "pistol whips", Skill = "skill_unarmed", HitBonus = -1, Damage = Rand.Constant(World.StandardIncrement * (1 - 2)), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = .86 * World.OneSecondInSpeed, APToReady = 100, Reach = 0, Strength = 8, Parry = -2 }; ef.Inherits("base_pistol1", "base_gun", new MeleeComponent( pistolTemplate)); pistolTemplate.Damage = Rand.Constant(World.StandardIncrement * (2 - 2)); pistolTemplate.AttackSpeed *= .95; ef.Inherits("base_pistol2", "base_gun", new MeleeComponent(pistolTemplate)); pistolTemplate.Damage = Rand.Constant(World.StandardIncrement * (3 - 2)); pistolTemplate.AttackSpeed *= .95; ef.Inherits("base_pistol3", "base_gun", new MeleeComponent(pistolTemplate)); ef.Inherits("glock17", "base_pistol2", //new Sprite("GLOCK17", Sprite.ITEMS_LAYER), new Identifier("Glock 17"), new Item(new Item.Template { Value = 60000, Weight = 19, Size = 2, StackType = StackType.None, }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Dice(2, World.StandardDeviation * 2) + Rand.Constant(2 * World.StandardIncrement), DamageType = Combat.DamageTypes["pierce"], Penetration = 1, Shots = 17, Range = 160, RoF = 3, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(3), Recoil = 2, Reliability = 18, Strength = 8, SwapClips = true, OneInTheChamber = true, AmmoCaliber = "9x19mm", })); ef.Inherits("glock22", "base_pistol2", //new Sprite("GLOCK22", Sprite.ITEMS_LAYER), new Identifier("Glock 22"), new Item(new Item.Template { Value = 40000, Weight = 21, Size = 2, StackType = StackType.None, }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Dice(2, World.StandardDeviation * 2) + Rand.Constant(10), DamageType = Combat.DamageTypes["pierce_large"], Penetration = 1, Shots = 15, Range = 160, RoF = 3, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(3), Recoil = 2, Reliability = 18, Strength = 8, SwapClips = true, OneInTheChamber = true, AmmoCaliber = ".40S&W" })); ef.Inherits("model10", "base_pistol2", //new Sprite("GLOCK22", Sprite.ITEMS_LAYER), new Identifier("S&W Model 10"), new Item(new Item.Template { Value = 50000, Weight = 20, Size = 2, StackType = StackType.None, }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Dice(2, World.StandardDeviation * 2), DamageType = Combat.DamageTypes["pierce_large"], Penetration = 1, Shots = 6, Range = 110, RoF = 3, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(3), Recoil = 2, Reliability = 18, Strength = 9, SwapClips = false, OneInTheChamber = false, AmmoCaliber = ".38S" })); ef.Inherits("model27", "base_pistol2", //new Sprite("MODEL27", Sprite.ITEMS_LAYER), new Identifier("S&W Model 27"), new Item(new Item.Template { Value = 60000, Weight = 30, Size = 2, StackType = StackType.None, }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Dice(3, World.StandardDeviation * 2), DamageType = Combat.DamageTypes["pierce_large"], Penetration = 1, Shots = 6, Range = 190, RoF = 3, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(3), Recoil = 3, Reliability = 18, Strength = 10, SwapClips = false, OneInTheChamber = false, AmmoCaliber = ".357M" })); ef.Inherits("cpython", "base_pistol2", //new Sprite("CPYTHON", Sprite.ITEMS_LAYER), new Identifier("Colt Python"), new Item(new Item.Template { Value = 85000, Weight = 29, Size = 2, StackType = StackType.None, }), new RangeComponent( new RangeComponent.Template { ActionDescription = "shoot", ActionDescriptionPlural = "shoots", Skill = "skill_pistol", Accuracy = 2, Damage = Rand.Dice(3, World.StandardDeviation * 2), DamageType = Combat.DamageTypes["pierce_large"], Penetration = 1, Shots = 6, Range = 190, RoF = 3, APToReady = World.SecondsToActionPoints(1f), APToReload = World.SecondsToActionPoints(3), Recoil = 3, Reliability = 18, Strength = 10, SwapClips = false, OneInTheChamber = false, AmmoCaliber = ".357M" })); }
private static void InitMelees(EntityFactory ef) { ef.Inherits("base_meleeweapon", "base_item", new Sprite("WEAPON", Sprite.ItemsLayer), Equipable.SingleSlot("Main Hand", "Off Hand"), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "hit", ActionDescriptionPlural = "hits", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(-10), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 1, Parry = -3 })); ef.Inherits("base_2hmelee", "base_meleeweapon", Equipable.MultipleSlots("Main Hand", "Off Hand")); ef.Inherits("largeknife", "base_meleeweapon", //new Sprite("LARGE_KNIFE", Sprite.ITEMS_LAYER), new Identifier("Knife, Large", "A large knife."), new Item( new Item.Template { Value = 4000, Weight = 10, Size = 2, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "slash", ActionDescriptionPlural = "slashes", Skill = "skill_knife", HitBonus = 0, Damage = Rand.Constant(-5), DamageType = Combat.DamageTypes["cut"], Penetration = 1, AttackSpeed = 1.1 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 6, Parry = -1 })); ef.Inherits("axe", "base_meleeweapon", //new Sprite("AXE", Sprite.ITEMS_LAYER), new Identifier("Axe", "An axe."), new Item( new Item.Template { Value = 5000, Weight = 40, Size = 3, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "hack", ActionDescriptionPlural = "hacks", Skill = "skill_axe", HitBonus = 0, Damage = Rand.Constant(10), DamageType = Combat.DamageTypes["cut"], Penetration = 1, AttackSpeed = .9 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 11, Parry = 0 })); ef.Inherits("hatchet", "base_meleeweapon", //new Sprite("HATCHET", Sprite.ITEMS_LAYER), new Identifier("Hatchet", "A hatchet."), new Item( new Item.Template { Value = 4000, Weight = 20, Size = 2, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "hack", ActionDescriptionPlural = "hacks", Skill = "skill_axe", HitBonus = 0, Damage = Rand.Constant(0), DamageType = Combat.DamageTypes["cut"], Penetration = 1, AttackSpeed = .92 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 8, Parry = 0 })); ef.Inherits("brassknuckles", "base_meleeweapon", //new Sprite("BRASS_KNUCKLES", Sprite.ITEMS_LAYER), new Identifier("Brass Knuckles"), new Item( new Item.Template { Value = 1000, Weight = 20, Size = 1, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "punch", ActionDescriptionPlural = "punches", Skill = "skill_unarmed", HitBonus = 0, Damage = Rand.Constant(0), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 0, Strength = 1, Parry = -1 })); ef.Inherits("smallknife", "base_meleeweapon", //new Sprite("SMALL_KNIFE", Sprite.ITEMS_LAYER), new Identifier("Knife", "A knife."), new Item( new Item.Template { Value = 3000, Weight = 5, Size = 1, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "jab", ActionDescriptionPlural = "jabs", Skill = "skill_knife", HitBonus = 0, Damage = Rand.Constant(0), DamageType = Combat.DamageTypes["impale"], Penetration = 1, AttackSpeed = 1.2 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 6, Parry = -1 })); ef.Inherits("club", "base_meleeweapon", new Identifier("Club", "A good size club."), new Item(new Item.Template { Value = 3000, Weight = 30, Size = 3, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "club", ActionDescriptionPlural = "clubs", Skill = "skill_axe", HitBonus = 0, Damage = Rand.Constant(7), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = .92 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 10, Parry = 0 })); ef.Inherits("baseball_bat", "base_2hmelee", new Identifier("Baseball bat", "A baseball bat."), new Item(new Item.Template { Value = 4000, Weight = 40, Size = 4, StackType = StackType.None, }), new MeleeComponent( new MeleeComponent.Template { ActionDescription = "club", ActionDescriptionPlural = "clubs", Skill = "skill_2haxe", HitBonus = 0, Damage = Rand.Constant(12), DamageType = Combat.DamageTypes["crush"], Penetration = 1, AttackSpeed = .88 * World.OneSecondInSpeed, APToReady = World.SecondsToActionPoints(1f), Reach = 1, Strength = 10, Parry = 0 })); }