Thread: [Rpgworldmodel-commits] SF.net SVN: rpgworldmodel: [9] src/RPGWorldModel.Abstracts
Status: Inactive
Brought to you by:
deadwood_pl
From: <dea...@us...> - 2006-07-03 20:23:49
|
Revision: 9 Author: deadwood_pl Date: 2006-07-03 13:23:33 -0700 (Mon, 03 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=9&view=rev Log Message: ----------- Remove IHandAllocator interface. Initial work on IEquipable interface implementation. Modified Paths: -------------- src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/IEquip.cs src/RPGWorldModel.Abstracts/IEquipable.cs src/RPGWorldModel.Abstracts/Item.cs src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj src/RPGWorldModel.Abstracts/Sword.cs src/RPGWorldModel.Abstracts/Weapon.cs Removed Paths: ------------- src/RPGWorldModel.Abstracts/IHandAllocator.cs Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -28,6 +28,7 @@ equipmentSlots.Add(new EquipmentSlotNeck()); equipmentSlots.Add(new EquipmentSlotTorso()); equipmentSlots.Add(new EquipmentSlotBack()); + equipmentSlots.Add(new EquipmentSlotWaist()); equipmentSlots.Add(new EquipmentSlotLeftArm()); equipmentSlots.Add(new EquipmentSlotRightArm()); equipmentSlots.Add(new EquipmentSlotLeftHand()); Modified: src/RPGWorldModel.Abstracts/IEquip.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquip.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -71,6 +71,10 @@ { } + public class EquipmentSlotWaist : EquipmentSlot + { + } + public class EquipmentSlotBack : EquipmentSlot { } Modified: src/RPGWorldModel.Abstracts/IEquipable.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquipable.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IEquipable.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -6,9 +6,64 @@ { public interface IEquipable { + void InitializeEquipable(); } public class EquipableList : List<IEquipable> { } + + + /* + * Equipment location - maps to equipement slot + */ + public abstract class EquipmentLocation + { + } + + public class EquipmentLocationList : List<EquipmentLocation> + { + } + + public class EquipmentLocationDescriptor + { + protected EquipmentLocationList equipmentLocationList = new EquipmentLocationList(); + + public IEnumerable<EquipmentLocation> EquipmentLocations + { + get { return equipmentLocationList; } + } + + public void AddEquipmentLocation(EquipmentLocation location) + { + foreach (EquipmentLocation containedLocation in equipmentLocationList) + { + if (containedLocation.GetType() == location.GetType()) + return; + } + + equipmentLocationList.Add(location); + } + } + + public class EquipmentLocationDescriptorList : List<EquipmentLocationDescriptor> + { + } + + public class EquipmentLocationLeftHand : EquipmentLocation + { + } + + public class EquipmentLocationRightHand : EquipmentLocation + { + } + + public class EquipmentLocationBack : EquipmentLocation + { + } + + public class EquipmentLocationWaist : EquipmentLocation + { + } + } Deleted: src/RPGWorldModel.Abstracts/IHandAllocator.cs =================================================================== --- src/RPGWorldModel.Abstracts/IHandAllocator.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/IHandAllocator.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace RPGWorldModel.Abstracts.Interfaces -{ - /// <summary> - /// Iterface for entities alocating entity hands - /// </summary> - public interface IHandAllocator - { - AllocatedHands Hands - { - get; - } - - void SetHandAllocation(HandAllocation newHandAllocation); - void InitializeHandAllocator(); - } - - public enum AllocatedHands - { - OneHand, - TwoHands - } - - public class HandAllocation : Initializable - { - private AllocatedHands allocatedHands = AllocatedHands.OneHand; - public AllocatedHands AllocatedHands - { - get { return allocatedHands; } - set { allocatedHands = value; } - } - } -} Modified: src/RPGWorldModel.Abstracts/Item.cs =================================================================== --- src/RPGWorldModel.Abstracts/Item.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Item.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -12,6 +12,8 @@ { protected Durability durability = new Durability(); + protected EquipmentLocationDescriptorList equipmentLocationDescriptors = + new EquipmentLocationDescriptorList(); #region Initialize Overrides @@ -19,7 +21,8 @@ { base.InitializeEntity(); - // InitializeEquipable ? + InitializeEquipable(); + InitializeDamagable(); } @@ -34,6 +37,12 @@ #endregion + #region IEquipableMembers + + public abstract void InitializeEquipable(); + + #endregion + #region IDamagable Members public short MaxDurability Modified: src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj =================================================================== --- src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-03 20:23:33 UTC (rev 9) @@ -44,7 +44,6 @@ <Compile Include="IDamageInflictor.cs" /> <Compile Include="IEquip.cs" /> <Compile Include="IEquipable.cs" /> - <Compile Include="IHandAllocator.cs" /> <Compile Include="ILiveEntity.cs" /> <Compile Include="IMagicEntity.cs" /> <Compile Include="INamedEntity.cs" /> Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -23,15 +23,6 @@ } } - public override void InitializeHandAllocator() - { - if (!allocation.IsInitialized) - { - allocation.AllocatedHands = AllocatedHands.OneHand; - allocation.IsInitialized = true; - } - } - public override void InitializeDamagable() { if (!durability.IsInitialized) @@ -67,7 +58,28 @@ randomizeDamageDescriptor(damageDescriptor); } } - + + public override void InitializeEquipable() + { + equipmentLocationDescriptors.Clear(); + + // Building descriptors + EquipmentLocationDescriptor leftHand = new EquipmentLocationDescriptor(); + leftHand.AddEquipmentLocation(new EquipmentLocationLeftHand()); + equipmentLocationDescriptors.Add(leftHand); + + EquipmentLocationDescriptor rightHand = new EquipmentLocationDescriptor(); + rightHand.AddEquipmentLocation(new EquipmentLocationRightHand()); + equipmentLocationDescriptors.Add(rightHand); + + EquipmentLocationDescriptor waist = new EquipmentLocationDescriptor(); + waist.AddEquipmentLocation(new EquipmentLocationWaist()); + equipmentLocationDescriptors.Add(waist); + + EquipmentLocationDescriptor back = new EquipmentLocationDescriptor(); + back.AddEquipmentLocation(new EquipmentLocationBack()); + equipmentLocationDescriptors.Add(back); + } #endregion } } Modified: src/RPGWorldModel.Abstracts/Weapon.cs =================================================================== --- src/RPGWorldModel.Abstracts/Weapon.cs 2006-06-26 15:10:32 UTC (rev 8) +++ src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-03 20:23:33 UTC (rev 9) @@ -5,9 +5,8 @@ namespace RPGWorldModel.Abstracts.Entities.Items { - public abstract class Weapon : Item, IHandAllocator, IDamageInflictor + public abstract class Weapon : Item, IDamageInflictor { - protected HandAllocation allocation = new HandAllocation(); protected DamageDescriptorDictionary damageDescriptors = new DamageDescriptorDictionary(); #region Initialize Overrides @@ -16,8 +15,6 @@ { base.InitializeEntity(); - InitializeHandAllocator(); - InitializeDamageInflictor(); } @@ -32,26 +29,6 @@ #endregion - - - #region IHandAllocator Members - - public AllocatedHands Hands - { - get { return allocation.AllocatedHands; } - } - - public abstract void InitializeHandAllocator(); - - public virtual void SetHandAllocation(HandAllocation newHandAllocation) - { - if (newHandAllocation == null) - throw new ArgumentException("newHandAllocation cannot be null", "newHandAllocation"); - - allocation = newHandAllocation; - } - #endregion - #region IDamageInflictor Members public abstract void InitializeDamageInflictor(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dea...@us...> - 2006-07-12 17:52:39
|
Revision: 14 Author: deadwood_pl Date: 2006-07-12 10:52:16 -0700 (Wed, 12 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=14&view=rev Log Message: ----------- More work on equipment. Still far from being acceptable at this stage. Modified Paths: -------------- src/RPGWorldModel.Abstracts/AnimatedEntity.cs src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/IEquip.cs src/RPGWorldModel.Abstracts/IEquipable.cs src/RPGWorldModel.Abstracts/Item.cs src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj src/RPGWorldModel.Abstracts/Sword.cs src/test_applications/tester/Form1.Designer.cs src/test_applications/tester/Form1.cs Added Paths: ----------- src/RPGWorldModel.Abstracts/EquipmentLocation.cs src/RPGWorldModel.Abstracts/EquipmentSlot.cs Modified: src/RPGWorldModel.Abstracts/AnimatedEntity.cs =================================================================== --- src/RPGWorldModel.Abstracts/AnimatedEntity.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/AnimatedEntity.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.Abstracts.Entities { Added: src/RPGWorldModel.Abstracts/EquipmentLocation.cs =================================================================== --- src/RPGWorldModel.Abstracts/EquipmentLocation.cs (rev 0) +++ src/RPGWorldModel.Abstracts/EquipmentLocation.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; + +namespace RPGWorldModel.Abstracts.Support.Equipment +{ + /// <summary> + /// Base for equipment location types + /// </summary> + public abstract class EquipmentLocation + { + } + + public class EquipmentLocationList : List<EquipmentLocation> + { + } + + public class EquipmentLocationDescriptor + { + protected EquipmentLocationList equipmentLocationList = new EquipmentLocationList(); + + public IEnumerable<EquipmentLocation> EquipmentLocations + { + get { return equipmentLocationList; } + } + + public int EquipmentLocationsCount + { + get { return equipmentLocationList.Count; } + } + + + + public void AddEquipmentLocation(EquipmentLocation location) + { + foreach (EquipmentLocation containedLocation in equipmentLocationList) + { + if (containedLocation.GetType() == location.GetType()) + return; + } + + equipmentLocationList.Add(location); + } + } + + public class EquipmentLocationDescriptorList : List<EquipmentLocationDescriptor> + { + } + + public class EquipmentLocationLeftHand : EquipmentLocation + { + } + + public class EquipmentLocationRightHand : EquipmentLocation + { + } + + public class EquipmentLocationBack : EquipmentLocation + { + } + + public class EquipmentLocationWaist : EquipmentLocation + { + } +} Added: src/RPGWorldModel.Abstracts/EquipmentSlot.cs =================================================================== --- src/RPGWorldModel.Abstracts/EquipmentSlot.cs (rev 0) +++ src/RPGWorldModel.Abstracts/EquipmentSlot.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -0,0 +1,185 @@ +using System; +using System.Collections.Generic; +using RPGWorldModel.Abstracts.Interfaces; + +namespace RPGWorldModel.Abstracts.Support.Equipment +{ + public abstract class EquipmentSlot + { + protected EquipableList equippedEntities = new EquipableList(); + public IEnumerable<IEquipable> EquippedEntities + { + get { return equippedEntities; } + } + + //TEST + protected EquipmentLocationList acceptableEquipmentLocations = new EquipmentLocationList(); + + public bool IsLocationAcceptable(EquipmentLocation location) + { + foreach (EquipmentLocation acceptableLocation in acceptableEquipmentLocations) + { + if (acceptableLocation.GetType() == location.GetType()) + return true; + } + + return false; + } + // + + public void AddEquipable(IEquipable equipable) + { + equippedEntities.Add(equipable); + } + + public void RemoveEquipable(IEquipable equipable) + { + equippedEntities.Remove(equipable); + } + + public abstract string SlotName + { + get; + } + } + + public class EquipmentSlotList : List<EquipmentSlot> + { + } + + public class EquipmentSlotHead : EquipmentSlot + { + public EquipmentSlotHead() + { + } + + public override string SlotName + { + get { return "Head"; } + } + } + + public class EquipmentSlotFace : EquipmentSlot + { + public override string SlotName + { + get { return "Face"; } + } + } + + public class EquipmentSlotNeck : EquipmentSlot + { + public override string SlotName + { + get { return "Neck"; } + } + } + + public class EquipmentSlotTorso : EquipmentSlot + { + public override string SlotName + { + get { return "Torso"; } + } + } + + public class EquipmentSlotWaist : EquipmentSlot + { + public EquipmentSlotWaist() + { + acceptableEquipmentLocations.Add(new EquipmentLocationWaist()); + } + + public override string SlotName + { + get { return "Waist"; } + } + } + + public class EquipmentSlotBack : EquipmentSlot + { + public EquipmentSlotBack() + { + acceptableEquipmentLocations.Add(new EquipmentLocationBack()); + } + + public override string SlotName + { + get { return "Back"; } + } + } + + public class EquipmentSlotLeftArm : EquipmentSlot + { + public override string SlotName + { + get { return "Left Arm"; } + } + } + + public class EquipmentSlotRightArm : EquipmentSlot + { + public override string SlotName + { + get { return "Right Arm"; } + } + } + + public class EquipmentSlotLeftHand : EquipmentSlot + { + public EquipmentSlotLeftHand() + { + acceptableEquipmentLocations.Add(new EquipmentLocationLeftHand()); + } + + public override string SlotName + { + get { return "Left Hand"; } + } + } + + public class EquipmentSlotRightHand : EquipmentSlot + { + public EquipmentSlotRightHand() + { + acceptableEquipmentLocations.Add(new EquipmentLocationRightHand()); + } + + public override string SlotName + { + get { return "Right Hand"; } + } + } + + public class EquipmentSlotLeftLeg : EquipmentSlot + { + public override string SlotName + { + get { return "Left Leg"; } + } + } + + public class EquipmentSlotRightLeg : EquipmentSlot + { + public override string SlotName + { + get { return "Right Leg"; } + } + } + + public class EquipmentSlotLeftFoot : EquipmentSlot + { + public override string SlotName + { + get { return "Left Foot"; } + } + } + + public class EquipmentSlotRightFoot : EquipmentSlot + { + public override string SlotName + { + get { return "Right Foot"; } + } + } +} \ No newline at end of file Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.Abstracts.Entities.LiveEntities { @@ -44,13 +45,55 @@ public override EquipResponse Equip(EquipRequest request) { + EquipResponse response = new EquipResponse(); + response.Status = EquipStatus.NotEquippedNotAbleToEquip; + + // Basic equip implementation for humanoids + foreach (EquipmentSlot slot in AvailableEquipmentSlots) + { + // Checking is slot is part of entity + if (slot == request.RequestedSlot) + { + // Checking is slot can accept any of the equipe locations for equipable + + foreach (EquipmentLocationDescriptor locationDescriptor + in request.RequestedEquipable.EquipmentLocationDescriptors) + { + // TODO: multi-slot items support + if (locationDescriptor.EquipmentLocationsCount > 1) + { + break; + } + + if (locationDescriptor.EquipmentLocationsCount == 0) + { + break; //TODO : error + } + + if (locationDescriptor.EquipmentLocationsCount == 1) + { + foreach (EquipmentLocation location in locationDescriptor.EquipmentLocations) + if (slot.IsLocationAcceptable(location)) + { + slot.AddEquipable(request.RequestedEquipable); + response.Status = EquipStatus.Equipped; + break; + } + } + + if (response.Status == EquipStatus.Equipped) + break; + + } + + if (response.Status == EquipStatus.Equipped) + break; + + } + } + - // TEMP!!!!! - equipmentSlots[8].AddEquipable(request.RequestedEquipable); - - EquipResponse response = new EquipResponse(); - response.Status = EquipStatus.Equipped; return response; } Modified: src/RPGWorldModel.Abstracts/IEquip.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.Abstracts.Interfaces { @@ -26,156 +27,16 @@ get { return requestedEquipable; } set { requestedEquipable = value; } } - } - /* - * Basic equipment slots start - */ + private EquipmentSlot requestedSlot = null; - public abstract class EquipmentSlot - { - protected EquipableList equippedEntities = new EquipableList(); - public IEnumerable<IEquipable> EquippedEntities + public EquipmentSlot RequestedSlot { - get { return equippedEntities; } + get { return requestedSlot; } + set { requestedSlot = value; } } - - public void AddEquipable(IEquipable equipable) - { - equippedEntities.Add(equipable); - } - - public void RemoveEquipable(IEquipable equipable) - { - equippedEntities.Remove(equipable); - } - - public abstract string SlotName - { - get; - } } - public class EquipmentSlotList : List<EquipmentSlot> - { - } - - public class EquipmentSlotHead : EquipmentSlot - { - public override string SlotName - { - get { return "Head"; } - } - } - - public class EquipmentSlotFace : EquipmentSlot - { - public override string SlotName - { - get { return "Face"; } - } - } - - public class EquipmentSlotNeck : EquipmentSlot - { - public override string SlotName - { - get { return "Neck"; } - } - } - - public class EquipmentSlotTorso : EquipmentSlot - { - public override string SlotName - { - get { return "Torso"; } - } - } - - public class EquipmentSlotWaist : EquipmentSlot - { - public override string SlotName - { - get { return "Waist"; } - } - } - - public class EquipmentSlotBack : EquipmentSlot - { - public override string SlotName - { - get { return "Back"; } - } - } - - public class EquipmentSlotLeftArm : EquipmentSlot - { - public override string SlotName - { - get { return "Left Arm"; } - } - } - - public class EquipmentSlotRightArm : EquipmentSlot - { - public override string SlotName - { - get { return "Right Arm"; } - } - } - - public class EquipmentSlotLeftHand : EquipmentSlot - { - public override string SlotName - { - get { return "Left Hand"; } - } - } - - public class EquipmentSlotRightHand : EquipmentSlot - { - public override string SlotName - { - get { return "Right Hand"; } - } - } - - public class EquipmentSlotLeftLeg : EquipmentSlot - { - public override string SlotName - { - get { return "Left Leg"; } - } - } - - public class EquipmentSlotRightLeg : EquipmentSlot - { - public override string SlotName - { - get { return "Right Leg"; } - } - } - - public class EquipmentSlotLeftFoot : EquipmentSlot - { - public override string SlotName - { - get { return "Left Foot"; } - } - } - - public class EquipmentSlotRightFoot : EquipmentSlot - { - public override string SlotName - { - get { return "Right Foot"; } - } - } - - /* - * Basic equipment slots end - */ - /// <summary> /// A response to equip request /// </summary> Modified: src/RPGWorldModel.Abstracts/IEquipable.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquipable.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/IEquipable.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -1,69 +1,21 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.Abstracts.Interfaces { public interface IEquipable { - void InitializeEquipable(); - } - - public class EquipableList : List<IEquipable> - { - } - - - /* - * Equipment location - maps to equipement slot - */ - public abstract class EquipmentLocation - { - } - - public class EquipmentLocationList : List<EquipmentLocation> - { - } - - public class EquipmentLocationDescriptor - { - protected EquipmentLocationList equipmentLocationList = new EquipmentLocationList(); - - public IEnumerable<EquipmentLocation> EquipmentLocations + IEnumerable<EquipmentLocationDescriptor> EquipmentLocationDescriptors { - get { return equipmentLocationList; } + get; } - public void AddEquipmentLocation(EquipmentLocation location) - { - foreach (EquipmentLocation containedLocation in equipmentLocationList) - { - if (containedLocation.GetType() == location.GetType()) - return; - } - - equipmentLocationList.Add(location); - } + void InitializeEquipable(); } - public class EquipmentLocationDescriptorList : List<EquipmentLocationDescriptor> + public class EquipableList : List<IEquipable> { } - - public class EquipmentLocationLeftHand : EquipmentLocation - { - } - - public class EquipmentLocationRightHand : EquipmentLocation - { - } - - public class EquipmentLocationBack : EquipmentLocation - { - } - - public class EquipmentLocationWaist : EquipmentLocation - { - } - } Modified: src/RPGWorldModel.Abstracts/Item.cs =================================================================== --- src/RPGWorldModel.Abstracts/Item.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/Item.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.Abstracts.Entities.Items { @@ -39,6 +40,11 @@ #region IEquipableMembers + public virtual IEnumerable<EquipmentLocationDescriptor> EquipmentLocationDescriptors + { + get { return equipmentLocationDescriptors; } + } + public abstract void InitializeEquipable(); #endregion Modified: src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj =================================================================== --- src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-12 17:52:16 UTC (rev 14) @@ -36,6 +36,8 @@ <Compile Include="Animal.cs" /> <Compile Include="AnimatedEntity.cs" /> <Compile Include="Arachnid.cs" /> + <Compile Include="EquipmentLocation.cs" /> + <Compile Include="EquipmentSlot.cs" /> <Compile Include="GameEntity.cs" /> <Compile Include="Golbin.cs" /> <Compile Include="Human.cs" /> Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -3,6 +3,7 @@ using System.Text; using RPGWorldModel.Abstracts.Interfaces; using RPGWorldModel.Abstracts.Entities.Items; +using RPGWorldModel.Abstracts.Support.Equipment; namespace RPGWorldModel.TopLevelImplementation.Entities.Items { Modified: src/test_applications/tester/Form1.Designer.cs =================================================================== --- src/test_applications/tester/Form1.Designer.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/test_applications/tester/Form1.Designer.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -59,13 +59,13 @@ this.btnItemRapair = new System.Windows.Forms.Button(); this.btnItemDamage = new System.Windows.Forms.Button(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.label4 = new System.Windows.Forms.Label(); this.btnEquipaSelected = new System.Windows.Forms.Button(); this.lvAvailableItems = new System.Windows.Forms.ListView(); this.tvEquipmentSlots = new System.Windows.Forms.TreeView(); this.btnHumanCreate = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); - this.label4 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -356,6 +356,16 @@ this.tabPage3.Text = "Equip"; this.tabPage3.UseVisualStyleBackColor = true; // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label4.Location = new System.Drawing.Point(253, 318); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(395, 13); + this.label4.TabIndex = 5; + this.label4.Text = "Select slot(back,waist,left hand, right hand), select item, click Equip"; + // // btnEquipaSelected // this.btnEquipaSelected.Location = new System.Drawing.Point(319, 342); @@ -408,16 +418,6 @@ // this.errorProvider1.ContainerControl = this; // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); - this.label4.Location = new System.Drawing.Point(320, 280); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(243, 13); - this.label4.TabIndex = 5; - this.label4.Text = "Select Left Hand, select item, click Equip"; - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); Modified: src/test_applications/tester/Form1.cs =================================================================== --- src/test_applications/tester/Form1.cs 2006-07-09 14:48:10 UTC (rev 13) +++ src/test_applications/tester/Form1.cs 2006-07-12 17:52:16 UTC (rev 14) @@ -10,6 +10,7 @@ using RPGWorldModel.Abstracts.Entities; using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Equipment; using RPGWorldModel.TopLevelImplementation.Entities.LiveEntities; using RPGWorldModel.TopLevelImplementation.Entities.Items; using RPGWorldModel.Implementation.Entities.Items.Swords; @@ -371,7 +372,11 @@ IronShortSword sword = new IronShortSword(); sword.InitializeEntity(); + WoodenTrainingSword wSword = new WoodenTrainingSword(); + wSword.InitializeEntity(); + availableEquipable.Add(sword); + availableEquipable.Add(wSword); refreshEquip(); } @@ -421,6 +426,7 @@ EquipRequest request = new EquipRequest(); request.RequestedEquipable = selectedEquipable; + request.RequestedSlot = slot; EquipResponse response = equipTest.Equip(request); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dea...@us...> - 2006-07-14 16:42:56
|
Revision: 15 Author: deadwood_pl Date: 2006-07-14 09:42:36 -0700 (Fri, 14 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=15&view=rev Log Message: ----------- More work on equipment. Support for multi-slot entites. Modified Paths: -------------- src/RPGWorldModel.Abstracts/EquipmentLocation.cs src/RPGWorldModel.Abstracts/EquipmentSlot.cs src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/IEquip.cs src/RPGWorldModel.Abstracts/Sword.cs src/RPGWorldModel.Implementation/Swords.cs src/test_applications/tester/Form1.Designer.cs src/test_applications/tester/Form1.cs src/test_applications/tester/tester.csproj Modified: src/RPGWorldModel.Abstracts/EquipmentLocation.cs =================================================================== --- src/RPGWorldModel.Abstracts/EquipmentLocation.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Abstracts/EquipmentLocation.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -46,6 +46,8 @@ { } + // Locations + public class EquipmentLocationLeftHand : EquipmentLocation { } @@ -61,4 +63,45 @@ public class EquipmentLocationWaist : EquipmentLocation { } + + public class EquipmentLocationHead : EquipmentLocation + { + } + + public class EquipmentLocationFace : EquipmentLocation + { + } + + public class EquipmentLocationTorso : EquipmentLocation + { + } + + public class EquipmentLocationLeftArm : EquipmentLocation + { + } + + public class EquipmentLocationRightArm : EquipmentLocation + { + } + + public class EquipmentLocationLeftLeg : EquipmentLocation + { + } + + public class EquipmentLocationRightLeg : EquipmentLocation + { + } + + public class EquipmentLocationLeftFoot : EquipmentLocation + { + } + + public class EquipmentLocationRightFoot : EquipmentLocation + { + } + + public class EquipmentLocationNeck : EquipmentLocation + { + } + } Modified: src/RPGWorldModel.Abstracts/EquipmentSlot.cs =================================================================== --- src/RPGWorldModel.Abstracts/EquipmentSlot.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Abstracts/EquipmentSlot.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -12,21 +12,13 @@ get { return equippedEntities; } } - //TEST - protected EquipmentLocationList acceptableEquipmentLocations = new EquipmentLocationList(); - - public bool IsLocationAcceptable(EquipmentLocation location) + public int EquippedEntitiesCount { - foreach (EquipmentLocation acceptableLocation in acceptableEquipmentLocations) - { - if (acceptableLocation.GetType() == location.GetType()) - return true; - } - - return false; + get { return equippedEntities.Count; } } - // + public abstract bool IsLocationAcceptable(EquipmentLocation location); + public void AddEquipable(IEquipable equipable) { equippedEntities.Add(equipable); @@ -47,15 +39,21 @@ { } + // Slots + public class EquipmentSlotHead : EquipmentSlot { - public EquipmentSlotHead() + public override string SlotName { + get { return "Head"; } } - public override string SlotName + public override bool IsLocationAcceptable(EquipmentLocation location) { - get { return "Head"; } + if (location is EquipmentLocationHead) + return true; + else + return false; } } @@ -65,6 +63,14 @@ { get { return "Face"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationFace) + return true; + else + return false; + } } public class EquipmentSlotNeck : EquipmentSlot @@ -73,6 +79,14 @@ { get { return "Neck"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationNeck) + return true; + else + return false; + } } public class EquipmentSlotTorso : EquipmentSlot @@ -81,31 +95,45 @@ { get { return "Torso"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationTorso) + return true; + else + return false; + } } public class EquipmentSlotWaist : EquipmentSlot { - public EquipmentSlotWaist() + public override string SlotName { - acceptableEquipmentLocations.Add(new EquipmentLocationWaist()); + get { return "Waist"; } } - public override string SlotName + public override bool IsLocationAcceptable(EquipmentLocation location) { - get { return "Waist"; } + if (location is EquipmentLocationWaist) + return true; + else + return false; } } public class EquipmentSlotBack : EquipmentSlot { - public EquipmentSlotBack() + public override string SlotName { - acceptableEquipmentLocations.Add(new EquipmentLocationBack()); + get { return "Back"; } } - public override string SlotName + public override bool IsLocationAcceptable(EquipmentLocation location) { - get { return "Back"; } + if (location is EquipmentLocationBack) + return true; + else + return false; } } @@ -115,6 +143,14 @@ { get { return "Left Arm"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationLeftArm) + return true; + else + return false; + } } public class EquipmentSlotRightArm : EquipmentSlot @@ -123,31 +159,45 @@ { get { return "Right Arm"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationRightArm) + return true; + else + return false; + } } public class EquipmentSlotLeftHand : EquipmentSlot { - public EquipmentSlotLeftHand() + public override string SlotName { - acceptableEquipmentLocations.Add(new EquipmentLocationLeftHand()); + get { return "Left Hand"; } } - public override string SlotName + public override bool IsLocationAcceptable(EquipmentLocation location) { - get { return "Left Hand"; } + if (location is EquipmentLocationLeftHand) + return true; + else + return false; } } public class EquipmentSlotRightHand : EquipmentSlot { - public EquipmentSlotRightHand() + public override string SlotName { - acceptableEquipmentLocations.Add(new EquipmentLocationRightHand()); + get { return "Right Hand"; } } - public override string SlotName + public override bool IsLocationAcceptable(EquipmentLocation location) { - get { return "Right Hand"; } + if (location is EquipmentLocationRightHand) + return true; + else + return false; } } @@ -157,6 +207,14 @@ { get { return "Left Leg"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationLeftLeg) + return true; + else + return false; + } } public class EquipmentSlotRightLeg : EquipmentSlot @@ -165,6 +223,14 @@ { get { return "Right Leg"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationRightLeg) + return true; + else + return false; + } } public class EquipmentSlotLeftFoot : EquipmentSlot @@ -173,6 +239,14 @@ { get { return "Left Foot"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationLeftFoot) + return true; + else + return false; + } } public class EquipmentSlotRightFoot : EquipmentSlot @@ -181,5 +255,13 @@ { get { return "Right Foot"; } } + + public override bool IsLocationAcceptable(EquipmentLocation location) + { + if (location is EquipmentLocationRightFoot) + return true; + else + return false; + } } } \ No newline at end of file Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -41,59 +41,102 @@ } #endregion - - + + public override EquipResponse Equip(EquipRequest request) { EquipResponse response = new EquipResponse(); - response.Status = EquipStatus.NotEquippedNotAbleToEquip; + response.Status = EquipStatus.Undefined; + response.AffectedSlot = null; + if (!equipmentSlots.Contains(request.RequestedSlot)) + { + response.Status = EquipStatus.NotEquippedSlotNotPartOfEntity; + response.AffectedSlot = request.RequestedSlot; + return response; + } - // Basic equip implementation for humanoids - foreach (EquipmentSlot slot in AvailableEquipmentSlots) + // Iterating over locations from equipable and trying to match them if open slots + + EquipmentSlotList selectedSlots = new EquipmentSlotList(); + bool initialSlotAccepting = false; + + foreach (EquipmentLocationDescriptor locationDescriptor in + request.RequestedEquipable.EquipmentLocationDescriptors) { - // Checking is slot is part of entity - if (slot == request.RequestedSlot) + initialSlotAccepting = false; + + // Checking if initial slot accepts any of the location + foreach (EquipmentLocation location in locationDescriptor.EquipmentLocations) + if (request.RequestedSlot.IsLocationAcceptable(location)) + { + initialSlotAccepting = true; + break; + } + + if (!initialSlotAccepting) { - // Checking is slot can accept any of the equipe locations for equipable + if (response.Status == EquipStatus.Undefined) + { + response.Status = EquipStatus.NotEquippedNotAbleToEquipToSlot; + response.AffectedSlot = request.RequestedSlot; + } - foreach (EquipmentLocationDescriptor locationDescriptor - in request.RequestedEquipable.EquipmentLocationDescriptors) + continue; + } + + // Initial is accepting, check other + selectedSlots.Clear(); + + foreach (EquipmentLocation location in locationDescriptor.EquipmentLocations) + { + foreach (EquipmentSlot slot in equipmentSlots) { - // TODO: multi-slot items support - if (locationDescriptor.EquipmentLocationsCount > 1) + // Can slot accept equipable + if (slot.IsLocationAcceptable(location)) { - break; + selectedSlots.Add(slot); + break; //NO OTHER LOCATION CAN ACCEPT } + } + } - if (locationDescriptor.EquipmentLocationsCount == 0) + if (selectedSlots.Count == locationDescriptor.EquipmentLocationsCount) + { + // Checking capacity + foreach (EquipmentSlot slot in selectedSlots) + { + // TEMP + if (slot.EquippedEntitiesCount > 0) { - break; //TODO : error + response.Status = EquipStatus.NotEquippedNoCapacityLeftInSlot; + response.AffectedSlot = slot; + break; } + } - if (locationDescriptor.EquipmentLocationsCount == 1) - { - foreach (EquipmentLocation location in locationDescriptor.EquipmentLocations) - if (slot.IsLocationAcceptable(location)) - { - slot.AddEquipable(request.RequestedEquipable); - response.Status = EquipStatus.Equipped; - break; - } - } + if (response.Status != EquipStatus.NotEquippedNoCapacityLeftInSlot) + { + // OK + response.Status = EquipStatus.Equipped; + response.AffectedSlot = request.RequestedSlot; - if (response.Status == EquipStatus.Equipped) - break; - + foreach (EquipmentSlot slot in selectedSlots) + slot.AddEquipable(request.RequestedEquipable); + + break; } - if (response.Status == EquipStatus.Equipped) - break; } + else + { + response.Status = EquipStatus.NotEquippedNotAbleToEquipToAdditionalSlots; + response.AffectedSlot = null; + } } - + return response; } Modified: src/RPGWorldModel.Abstracts/IEquip.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -49,14 +49,25 @@ get { return status; } set { status = value; } } + + private EquipmentSlot affectedSlot = null; + + public EquipmentSlot AffectedSlot + { + get { return affectedSlot; } + set { affectedSlot = value; } + } } public enum EquipStatus { Undefined, Equipped, - NotEquippedNotAbleToEquip, + NotEquippedNotAbleToEquipToSlot, NotEquippedConflictingWithAlreadyEquippedEntity, NotEquippedNotAbleToEquipAnyEntities, // If and entity is not able to equipe any entities (e.g. animals) + NotEquippedNoCapacityLeftInSlot, + NotEquippedSlotNotPartOfEntity, + NotEquippedNotAbleToEquipToAdditionalSlots } } Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -28,8 +28,8 @@ { if (!durability.IsInitialized) { - durability.BaseDurability = 1000; - durability.DurabilityMargin = 15; + durability.BaseDurability = 0; + durability.DurabilityMargin = 0; durability.IsInitialized = true; durability.RandomizationRequired = true; } @@ -47,10 +47,10 @@ { if (!damageDescriptor.IsInitialized && damageDescriptor is DamageDescriptorPhysical) { - damageDescriptor.BaseMinDamage = 30; - damageDescriptor.MinDamageMargin = 5; - damageDescriptor.BaseMaxDamage = 35; - damageDescriptor.MaxDamageMargin = 10; + damageDescriptor.BaseMinDamage = 0; + damageDescriptor.MinDamageMargin = 0; + damageDescriptor.BaseMaxDamage = 0; + damageDescriptor.MaxDamageMargin = 0; damageDescriptor.IsInitialized = true; damageDescriptor.RandomizationRequired = true; } @@ -83,4 +83,68 @@ } #endregion } + + public class TwoHandedSword : Sword + { + public TwoHandedSword() + { + } + + #region Initialization Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Two-Handed Sword"; + name.IsInitialized = true; + } + } + + public override void InitializeDamagable() + { + if (!durability.IsInitialized) + { + durability.BaseDurability = 0; + durability.DurabilityMargin = 0; + durability.IsInitialized = true; + durability.RandomizationRequired = true; + } + + if (durability.RandomizationRequired) + randomizeMaxDurability(); + } + + public override void InitializeDamageInflictor() + { + DamageDescriptorPhysical damageDesc = new DamageDescriptorPhysical(); + damageDesc.BaseMaxDamage = 0; + damageDesc.MaxDamageMargin = 0; + damageDesc.BaseMinDamage = 0; + damageDesc.MinDamageMargin = 0; + damageDesc.IsInitialized = true; + damageDesc.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(damageDesc); + + base.InitializeDamageInflictor(); + } + + public override void InitializeEquipable() + { + equipmentLocationDescriptors.Clear(); + + // Building descriptors + EquipmentLocationDescriptor bothHands = new EquipmentLocationDescriptor(); + bothHands.AddEquipmentLocation(new EquipmentLocationLeftHand()); + bothHands.AddEquipmentLocation(new EquipmentLocationRightHand()); + equipmentLocationDescriptors.Add(bothHands); + + EquipmentLocationDescriptor back = new EquipmentLocationDescriptor(); + back.AddEquipmentLocation(new EquipmentLocationBack()); + equipmentLocationDescriptors.Add(back); + } + #endregion + } + } Modified: src/RPGWorldModel.Implementation/Swords.cs =================================================================== --- src/RPGWorldModel.Implementation/Swords.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/RPGWorldModel.Implementation/Swords.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -76,4 +76,41 @@ #endregion } + + + /// <summary> + /// Bronze Two-Handed Sword + /// </summary> + public class BronzeTwoHandedSword : TwoHandedSword + { + public BronzeTwoHandedSword() + { + name.Value = "Bronze Two-Handed Sword"; + name.IsInitialized = true; + + durability.BaseDurability = 2000; + durability.DurabilityMargin = 20; + durability.IsInitialized = true; + durability.RandomizationRequired = true; + } + + #region Initialization Overrides + + public override void InitializeDamageInflictor() + { + DamageDescriptorPhysical damageDesc = new DamageDescriptorPhysical(); + damageDesc.BaseMaxDamage = 40; + damageDesc.MaxDamageMargin = 10; + damageDesc.BaseMinDamage = 5; + damageDesc.MinDamageMargin = 10; + damageDesc.IsInitialized = true; + damageDesc.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(damageDesc); + + base.InitializeDamageInflictor(); + } + + #endregion + } } \ No newline at end of file Modified: src/test_applications/tester/Form1.Designer.cs =================================================================== --- src/test_applications/tester/Form1.Designer.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/test_applications/tester/Form1.Designer.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -380,6 +380,7 @@ // this.lvAvailableItems.HideSelection = false; this.lvAvailableItems.Location = new System.Drawing.Point(319, 176); + this.lvAvailableItems.MultiSelect = false; this.lvAvailableItems.Name = "lvAvailableItems"; this.lvAvailableItems.Size = new System.Drawing.Size(322, 97); this.lvAvailableItems.TabIndex = 3; Modified: src/test_applications/tester/Form1.cs =================================================================== --- src/test_applications/tester/Form1.cs 2006-07-12 17:52:16 UTC (rev 14) +++ src/test_applications/tester/Form1.cs 2006-07-14 16:42:36 UTC (rev 15) @@ -312,17 +312,32 @@ { if (equipable is Sword) { - g.FillRectangle(Brushes.Blue, x, y, 5, 100); - g.FillRectangle(Brushes.Blue, x - 10, y + 20, 25, 5); + int swordLength = 100; + Brush selectedBrush = Brushes.Gray; + + if (equipable is WoodenTrainingSword) + { + selectedBrush = Brushes.Brown; + swordLength = 80; + } + + if (equipable is BronzeTwoHandedSword) + { + selectedBrush = Brushes.DarkRed; + swordLength = 140; + } + + g.FillRectangle(selectedBrush, x, y, 5, swordLength); + g.FillRectangle(selectedBrush, x - 10, y + 20, 25, 5); Point[] points = new Point[3]; points[0].X = x; - points[0].Y = y + 100; + points[0].Y = y + swordLength; points[1].X = x + 2; - points[1].Y = y + 110; + points[1].Y = y + swordLength + 10; points[2].X = x+5; - points[2].Y = y + 100; - g.FillPolygon(Brushes.Blue, points); + points[2].Y = y + swordLength; + g.FillPolygon(selectedBrush, points); } } @@ -369,14 +384,20 @@ equipTest = new Human(); equipTest.InitializeEntity(); + availableEquipable.Clear(); + IronShortSword sword = new IronShortSword(); sword.InitializeEntity(); WoodenTrainingSword wSword = new WoodenTrainingSword(); wSword.InitializeEntity(); + BronzeTwoHandedSword bthSword = new BronzeTwoHandedSword(); + bthSword.InitializeEntity(); + availableEquipable.Add(sword); availableEquipable.Add(wSword); + availableEquipable.Add(bthSword); refreshEquip(); } @@ -433,6 +454,21 @@ if (response.Status == EquipStatus.Equipped) availableEquipable.Remove(selectedEquipable); + if (response.Status == EquipStatus.NotEquippedNoCapacityLeftInSlot) + { + MessageBox.Show("You cannot put more items into " + (response.AffectedSlot != null ? response.AffectedSlot.SlotName : "UNKNOWN")); + } + + if (response.Status == EquipStatus.NotEquippedNotAbleToEquipToSlot) + { + MessageBox.Show("You cannot put " + (selectedEquipable as INamedEntity).Name + " into " + (response.AffectedSlot != null ? response.AffectedSlot.SlotName : "UNKNOWN")); + } + + if (response.Status == EquipStatus.NotEquippedNotAbleToEquipToAdditionalSlots) + { + MessageBox.Show("You cannot put " + (selectedEquipable as INamedEntity).Name + " becuase of lack of capacity in other slots"); + } + refreshEquip(); } } Modified: src/test_applications/tester/tester.csproj =================================================================== --- src/test_applications/tester/tester.csproj 2006-07-12 17:52:16 UTC (rev 14) +++ src/test_applications/tester/tester.csproj 2006-07-14 16:42:36 UTC (rev 15) @@ -18,6 +18,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <UseVSHostingProcess>false</UseVSHostingProcess> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dea...@us...> - 2006-07-15 16:39:18
|
Revision: 18 Author: deadwood_pl Date: 2006-07-15 09:39:03 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=18&view=rev Log Message: ----------- Support for unequipping entities. Modified Paths: -------------- src/RPGWorldModel.Abstracts/Animal.cs src/RPGWorldModel.Abstracts/AnimatedEntity.cs src/RPGWorldModel.Abstracts/EquipmentSlot.cs src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/IEquip.cs src/test_applications/tester/Form1.Designer.cs src/test_applications/tester/Form1.cs Modified: src/RPGWorldModel.Abstracts/Animal.cs =================================================================== --- src/RPGWorldModel.Abstracts/Animal.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/RPGWorldModel.Abstracts/Animal.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -32,6 +32,14 @@ return response; } + public override UnEquipResponse UnEquip(UnEquipRequest request) + { + // Animals by default have no equip abilities + UnEquipResponse response = new UnEquipResponse(); + response.Status = UnEquipStatus.NotUnEquippedNotAbleToUnEquipAnyEntities; + return response; + } + #endregion } Modified: src/RPGWorldModel.Abstracts/AnimatedEntity.cs =================================================================== --- src/RPGWorldModel.Abstracts/AnimatedEntity.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/RPGWorldModel.Abstracts/AnimatedEntity.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -23,6 +23,8 @@ public abstract EquipResponse Equip(EquipRequest request); + public abstract UnEquipResponse UnEquip(UnEquipRequest request); + public abstract void InitializeEquip(); #endregion Modified: src/RPGWorldModel.Abstracts/EquipmentSlot.cs =================================================================== --- src/RPGWorldModel.Abstracts/EquipmentSlot.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/RPGWorldModel.Abstracts/EquipmentSlot.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -29,6 +29,11 @@ equippedEntities.Remove(equipable); } + public bool ContainsEquipable(IEquipable equipable) + { + return equippedEntities.Contains(equipable); + } + public abstract string SlotName { get; Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -140,6 +140,35 @@ return response; } + public override UnEquipResponse UnEquip(UnEquipRequest request) + { + UnEquipResponse response = new UnEquipResponse(); + response.Status = UnEquipStatus.Undefined; + + EquipmentSlotList affectedSlots = new EquipmentSlotList(); + + foreach (EquipmentSlot slot in equipmentSlots) + { + if (slot.ContainsEquipable(request.RequestedEquipable)) + affectedSlots.Add(slot); + } + + if (affectedSlots.Count == 0) + { + // Not equipped + response.Status = UnEquipStatus.NotUnEquippedEquipableNotEquipped; + } + else + { + // Remove the equipable + foreach(EquipmentSlot slot in affectedSlots) + slot.RemoveEquipable(request.RequestedEquipable); + + response.Status = UnEquipStatus.UnEquipped; + } + + return response; + } } public abstract class HumanoidAdvanced : Humanoid Modified: src/RPGWorldModel.Abstracts/IEquip.cs =================================================================== --- src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/RPGWorldModel.Abstracts/IEquip.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -15,6 +15,9 @@ // Equip an entity EquipResponse Equip(EquipRequest request); + // UnEquip an entity + UnEquipResponse UnEquip(UnEquipRequest request); + // Initialized equip interface implementation void InitializeEquip(); } @@ -37,6 +40,16 @@ } } + public class UnEquipRequest + { + private IEquipable requestedEquipable = null; + public IEquipable RequestedEquipable + { + get { return requestedEquipable; } + set { requestedEquipable = value; } + } + } + /// <summary> /// A response to equip request /// </summary> @@ -59,6 +72,17 @@ } } + public class UnEquipResponse + { + private UnEquipStatus status = UnEquipStatus.Undefined; + + public UnEquipStatus Status + { + get { return status; } + set { status = value; } + } + } + public enum EquipStatus { Undefined, @@ -70,4 +94,12 @@ NotEquippedSlotNotPartOfEntity, NotEquippedNotAbleToEquipToAdditionalSlots } + + public enum UnEquipStatus + { + Undefined, + UnEquipped, + NotUnEquippedEquipableNotEquipped, + NotUnEquippedNotAbleToUnEquipAnyEntities + } } Modified: src/test_applications/tester/Form1.Designer.cs =================================================================== --- src/test_applications/tester/Form1.Designer.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/test_applications/tester/Form1.Designer.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -59,6 +59,7 @@ this.btnItemRapair = new System.Windows.Forms.Button(); this.btnItemDamage = new System.Windows.Forms.Button(); this.tabPage3 = new System.Windows.Forms.TabPage(); + this.btnUnEquip = new System.Windows.Forms.Button(); this.label4 = new System.Windows.Forms.Label(); this.btnEquipaSelected = new System.Windows.Forms.Button(); this.lvAvailableItems = new System.Windows.Forms.ListView(); @@ -66,6 +67,7 @@ this.btnHumanCreate = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components); + this.label5 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.tabPage2.SuspendLayout(); @@ -343,6 +345,8 @@ // // tabPage3 // + this.tabPage3.Controls.Add(this.label5); + this.tabPage3.Controls.Add(this.btnUnEquip); this.tabPage3.Controls.Add(this.label4); this.tabPage3.Controls.Add(this.btnEquipaSelected); this.tabPage3.Controls.Add(this.lvAvailableItems); @@ -356,6 +360,16 @@ this.tabPage3.Text = "Equip"; this.tabPage3.UseVisualStyleBackColor = true; // + // btnUnEquip + // + this.btnUnEquip.Location = new System.Drawing.Point(419, 342); + this.btnUnEquip.Name = "btnUnEquip"; + this.btnUnEquip.Size = new System.Drawing.Size(75, 23); + this.btnUnEquip.TabIndex = 6; + this.btnUnEquip.Text = "UnEquip"; + this.btnUnEquip.UseVisualStyleBackColor = true; + this.btnUnEquip.Click += new System.EventHandler(this.btnUnEquip_Click); + // // label4 // this.label4.AutoSize = true; @@ -419,6 +433,16 @@ // this.errorProvider1.ContainerControl = this; // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238))); + this.label5.Location = new System.Drawing.Point(319, 312); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(157, 13); + this.label5.TabIndex = 7; + this.label5.Text = "Select item, click UnEquip"; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -480,6 +504,8 @@ private System.Windows.Forms.ListView lvAvailableItems; private System.Windows.Forms.Button btnEquipaSelected; private System.Windows.Forms.Label label4; + private System.Windows.Forms.Button btnUnEquip; + private System.Windows.Forms.Label label5; } } Modified: src/test_applications/tester/Form1.cs =================================================================== --- src/test_applications/tester/Form1.cs 2006-07-15 13:38:17 UTC (rev 17) +++ src/test_applications/tester/Form1.cs 2006-07-15 16:39:03 UTC (rev 18) @@ -543,11 +543,16 @@ if (equipTest == null) return; + EquipmentSlotTreeNode slotNode = tvEquipmentSlots.SelectedNode as EquipmentSlotTreeNode; + + if (slotNode == null) + return; + IEquipable selectedEquipable = (lvAvailableItems.SelectedItems[0] as EquipableListViewItem).Equipable; - + EquipmentSlot slot = - (tvEquipmentSlots.SelectedNode as EquipmentSlotTreeNode).Slot; + slotNode.Slot; EquipRequest request = new EquipRequest(); request.RequestedEquipable = selectedEquipable; @@ -575,6 +580,39 @@ refreshEquip(); } + + private void btnUnEquip_Click(object sender, EventArgs e) + { + if (tvEquipmentSlots.SelectedNode == null) + return; + + if (equipTest == null) + return; + + EquipableTreeNode equipableNode = (tvEquipmentSlots.SelectedNode as EquipableTreeNode); + + if (equipableNode == null) + return; + + UnEquipRequest request = new UnEquipRequest(); + request.RequestedEquipable = equipableNode.Equipable; + + UnEquipResponse response = equipTest.UnEquip(request); + + if (response.Status == UnEquipStatus.NotUnEquippedEquipableNotEquipped) + { + MessageBox.Show("Entity is not equipped"); + } + + if (response.Status == UnEquipStatus.UnEquipped) + { + // add to available + availableEquipable.Add(request.RequestedEquipable); + } + + refreshEquip(); + + } } public class EquipmentSlotTreeNode : TreeNode @@ -600,10 +638,31 @@ this.Text = slot.SlotName; foreach (IEquipable equipable in Slot.EquippedEntities) - this.Nodes.Add((equipable as INamedEntity).Name); + this.Nodes.Add(new EquipableTreeNode (equipable)); } } + public class EquipableTreeNode : TreeNode + { + private IEquipable equipable = null; + + public IEquipable Equipable + { + get { return equipable; } + set { equipable = value; } + } + + public EquipableTreeNode(IEquipable equipable) + { + if (equipable == null) + throw new ArgumentException("equipable must not be null", "equipable"); + + Equipable = equipable; + + this.Text = (equipable as INamedEntity).Name; + } + } + public class EquipableListViewItem : ListViewItem { private IEquipable equipable = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dea...@us...> - 2006-07-16 09:16:04
|
Revision: 19 Author: deadwood_pl Date: 2006-07-16 02:15:26 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=19&view=rev Log Message: ----------- Reorganization in namespaces connected with damage. Modified Paths: -------------- src/RPGWorldModel.Abstracts/Club.cs src/RPGWorldModel.Abstracts/IDamagable.cs src/RPGWorldModel.Abstracts/IDamageInflictor.cs src/RPGWorldModel.Abstracts/ILiveEntity.cs src/RPGWorldModel.Abstracts/INamedEntity.cs src/RPGWorldModel.Abstracts/Initializable.cs src/RPGWorldModel.Abstracts/Knife.cs src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj src/RPGWorldModel.Abstracts/Sword.cs src/RPGWorldModel.Abstracts/Weapon.cs src/RPGWorldModel.Implementation/Clubs.cs src/RPGWorldModel.Implementation/Knifes.cs src/RPGWorldModel.Implementation/Swords.cs src/test_applications/tester/Form1.cs Added Paths: ----------- src/RPGWorldModel.Abstracts/DamageDescriptor.cs src/RPGWorldModel.Abstracts/InflictedDamage.cs Modified: src/RPGWorldModel.Abstracts/Club.cs =================================================================== --- src/RPGWorldModel.Abstracts/Club.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/Club.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,7 @@ using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.Abstracts.Support.Equipment; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.Items { Added: src/RPGWorldModel.Abstracts/DamageDescriptor.cs =================================================================== --- src/RPGWorldModel.Abstracts/DamageDescriptor.cs (rev 0) +++ src/RPGWorldModel.Abstracts/DamageDescriptor.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using RPGWorldModel.Abstracts.Support.Misc; + +namespace RPGWorldModel.Abstracts.Support.Damage +{ + /// <summary> + /// Dictionary of DamageDescriptor object indexed by type + /// </summary> + public class DamageDescriptorDictionary : Dictionary<Type, DamageDescriptor> + { + } + + public abstract class DamageDescriptor : Initializable + { + private short minDamage = 0; + public short MinDamage + { + get { return minDamage; } + set { minDamage = value; } + } + + private short maxDamage = 0; + public short MaxDamage + { + get { return maxDamage; } + set { maxDamage = value; } + } + + /* + * Base values + */ + + private short baseMinDamage = 0; + public short BaseMinDamage + { + get { return baseMinDamage; } + set { baseMinDamage = value; } + } + + private byte minDamageMargin = 0; + public byte MinDamageMargin + { + get { return minDamageMargin; } + set { minDamageMargin = value; } + } + + private short baseMaxDamage = 0; + public short BaseMaxDamage + { + get { return baseMaxDamage; } + set { baseMaxDamage = value; } + } + + private byte maxDamageMargin = 0; + public byte MaxDamageMargin + { + get { return maxDamageMargin; } + set { maxDamageMargin = value; } + } + + /// <summary> + /// Creates an instance of specified inflicted damage type + /// </summary> + /// <returns></returns> + public abstract InflictedDamage CreateInflictedDamage(); + } + + /* + * Concrete types of damage + */ + + public class DamageDescriptorPhysical : DamageDescriptor + { + public override InflictedDamage CreateInflictedDamage() + { + return new InflictedDamagePhysical(); + } + } + + public class DamageDescriptorFire : DamageDescriptor + { + public override InflictedDamage CreateInflictedDamage() + { + return new InflictedDamageFire(); + } + } +} \ No newline at end of file Modified: src/RPGWorldModel.Abstracts/IDamagable.cs =================================================================== --- src/RPGWorldModel.Abstracts/IDamagable.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/IDamagable.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Misc; namespace RPGWorldModel.Abstracts.Interfaces { Modified: src/RPGWorldModel.Abstracts/IDamageInflictor.cs =================================================================== --- src/RPGWorldModel.Abstracts/IDamageInflictor.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/IDamageInflictor.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Abstracts.Interfaces { @@ -17,148 +18,12 @@ /// Gets all types of inflicted damages along with values /// </summary> /// <returns></returns> - InflictedDamageResponse GetInflictedDamage(); + DamageInflictorInflictedDamageResponse GetInflictedDamage(); } - public abstract class DamageDescriptor : Initializable + public class DamageInflictorInflictedDamageResponse : InflictedDamageResponse { - private short minDamage = 0; - public short MinDamage - { - get { return minDamage; } - set { minDamage = value; } - } - - private short maxDamage = 0; - public short MaxDamage - { - get { return maxDamage; } - set { maxDamage = value; } - } - - /* - * Base values - */ - - private short baseMinDamage = 0; - public short BaseMinDamage - { - get { return baseMinDamage; } - set { baseMinDamage = value; } - } - - private byte minDamageMargin = 0; - public byte MinDamageMargin - { - get { return minDamageMargin; } - set { minDamageMargin = value; } - } - - private short baseMaxDamage = 0; - public short BaseMaxDamage - { - get { return baseMaxDamage; } - set { baseMaxDamage = value; } - } - - private byte maxDamageMargin = 0; - public byte MaxDamageMargin - { - get { return maxDamageMargin; } - set { maxDamageMargin = value; } - } - - /// <summary> - /// Creates an instance of specified inflicted damage type - /// </summary> - /// <returns></returns> - public abstract InflictedDamage CreateInflictedDamage(); } - /// <summary> - /// Dictionary of DamageDescriptor object indexed by type - /// </summary> - public class DamageDescriptorDictionary : Dictionary<Type, DamageDescriptor> - { - } - public class InflictedDamageResponse - { - protected InflictedDamageList inflictedDamages = new InflictedDamageList(); - - public void Add(InflictedDamage inflictedDamage) - { - inflictedDamages.Add(inflictedDamage); - } - - public IEnumerable<InflictedDamage> InflictedDamages - { - get { return inflictedDamages; } - } - } - - /// <summary> - /// Holds damage inflicted by an entity - /// </summary> - public abstract class InflictedDamage - { - private short minDamage = 0; - public virtual short MinDamage - { - get { return minDamage; } - } - - private short maxDamage = 0; - public virtual short MaxDamage - { - get { return maxDamage; } - } - - protected InflictedDamage() - { - } - - public virtual void SetDamage(short minDamage, short maxDamage) - { - if (minDamage > maxDamage) - throw new ArgumentException("minDamage must not be greater than maxDamage"); - - this.minDamage = minDamage; - this.maxDamage = maxDamage; - } - - - } - - public class InflictedDamageList : List<InflictedDamage> - { - } - - /* - * Concrete types of damage - */ - - public class DamageDescriptorPhysical : DamageDescriptor - { - public override InflictedDamage CreateInflictedDamage() - { - return new InflictedDamagePhysical(); - } - } - - public class InflictedDamagePhysical : InflictedDamage - { - } - - public class DamageDescriptorFire : DamageDescriptor - { - public override InflictedDamage CreateInflictedDamage() - { - return new InflictedDamageFire(); - } - } - - public class InflictedDamageFire : InflictedDamage - { - } } Modified: src/RPGWorldModel.Abstracts/ILiveEntity.cs =================================================================== --- src/RPGWorldModel.Abstracts/ILiveEntity.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/ILiveEntity.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Misc; namespace RPGWorldModel.Abstracts.Interfaces { Modified: src/RPGWorldModel.Abstracts/INamedEntity.cs =================================================================== --- src/RPGWorldModel.Abstracts/INamedEntity.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/INamedEntity.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using RPGWorldModel.Abstracts.Support.Misc; namespace RPGWorldModel.Abstracts.Interfaces { Added: src/RPGWorldModel.Abstracts/InflictedDamage.cs =================================================================== --- src/RPGWorldModel.Abstracts/InflictedDamage.cs (rev 0) +++ src/RPGWorldModel.Abstracts/InflictedDamage.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; + +namespace RPGWorldModel.Abstracts.Support.Damage +{ + /// <summary> + /// Holds damage inflicted by an entity + /// </summary> + public abstract class InflictedDamage + { + private short minDamage = 0; + public virtual short MinDamage + { + get { return minDamage; } + } + + private short maxDamage = 0; + public virtual short MaxDamage + { + get { return maxDamage; } + } + + protected InflictedDamage() + { + } + + public virtual void SetDamage(short minDamage, short maxDamage) + { + if (minDamage > maxDamage) + throw new ArgumentException("minDamage must not be greater than maxDamage"); + + this.minDamage = minDamage; + this.maxDamage = maxDamage; + } + + + } + + public class InflictedDamageList : List<InflictedDamage> + { + } + + public class InflictedDamageDictionaty : Dictionary<Type, InflictedDamage> + { + } + + public class InflictedDamageResponse + { + protected InflictedDamageDictionaty inflictedDamages = new InflictedDamageDictionaty(); + + public virtual void Set(InflictedDamage inflictedDamage) + { + inflictedDamages[inflictedDamage.GetType()] = inflictedDamage; + } + + public virtual void Sum(InflictedDamage inflictedDamage) + { + InflictedDamage existing = inflictedDamages[inflictedDamage.GetType()]; + + if (existing == null) + Set(inflictedDamage); + else + { + existing.SetDamage( + (short)(existing.MinDamage + inflictedDamage.MinDamage), + (short)(existing.MaxDamage + inflictedDamage.MaxDamage)); + } + } + + public IEnumerable<InflictedDamage> InflictedDamages + { + get { return inflictedDamages.Values; } + } + } + + public class InflictedDamagePhysical : InflictedDamage + { + } + + public class InflictedDamageFire : InflictedDamage + { + } +} \ No newline at end of file Modified: src/RPGWorldModel.Abstracts/Initializable.cs =================================================================== --- src/RPGWorldModel.Abstracts/Initializable.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/Initializable.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace RPGWorldModel.Abstracts.Interfaces +namespace RPGWorldModel.Abstracts.Support.Misc { public class Initializable { Modified: src/RPGWorldModel.Abstracts/Knife.cs =================================================================== --- src/RPGWorldModel.Abstracts/Knife.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/Knife.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,7 @@ using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.Abstracts.Support.Equipment; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.Items { Modified: src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj =================================================================== --- src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-16 09:15:26 UTC (rev 19) @@ -38,6 +38,7 @@ <Compile Include="Arachnid.cs" /> <Compile Include="Clothing.cs" /> <Compile Include="Club.cs" /> + <Compile Include="DamageDescriptor.cs" /> <Compile Include="EquipmentLocation.cs" /> <Compile Include="EquipmentSlot.cs" /> <Compile Include="GameEntity.cs" /> @@ -52,6 +53,7 @@ <Compile Include="IMagicEntity.cs" /> <Compile Include="INamedEntity.cs" /> <Compile Include="InAnimatedEntity.cs" /> + <Compile Include="InflictedDamage.cs" /> <Compile Include="Initializable.cs" /> <Compile Include="Item.cs" /> <Compile Include="Knife.cs" /> Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -4,6 +4,7 @@ using RPGWorldModel.Abstracts.Interfaces; using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.Abstracts.Support.Equipment; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.Items { Modified: src/RPGWorldModel.Abstracts/Weapon.cs =================================================================== --- src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,8 @@ using System.Collections.Generic; using System.Text; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Misc; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Abstracts.Entities.Items { @@ -47,9 +49,10 @@ /// Default implementation with all damages beeing changed by durability /// </summary> /// <returns></returns> - public virtual InflictedDamageResponse GetInflictedDamage() + public virtual DamageInflictorInflictedDamageResponse GetInflictedDamage() { - InflictedDamageResponse response = new InflictedDamageResponse(); + DamageInflictorInflictedDamageResponse response = + new DamageInflictorInflictedDamageResponse(); short min = 0; short max = 0; @@ -63,7 +66,7 @@ damage.SetDamage(min, max); - response.Add(damage); + response.Set(damage); } Modified: src/RPGWorldModel.Implementation/Clubs.cs =================================================================== --- src/RPGWorldModel.Implementation/Clubs.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Implementation/Clubs.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,7 @@ using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.TopLevelImplementation.Entities.Items; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Implementation.Entities.Items.Clubs { Modified: src/RPGWorldModel.Implementation/Knifes.cs =================================================================== --- src/RPGWorldModel.Implementation/Knifes.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Implementation/Knifes.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,7 @@ using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.TopLevelImplementation.Entities.Items; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Implementation.Entities.Items.Knifes { Modified: src/RPGWorldModel.Implementation/Swords.cs =================================================================== --- src/RPGWorldModel.Implementation/Swords.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/RPGWorldModel.Implementation/Swords.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -2,6 +2,7 @@ using RPGWorldModel.Abstracts.Entities.Items; using RPGWorldModel.TopLevelImplementation.Entities.Items; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Implementation.Entities.Items.Swords { Modified: src/test_applications/tester/Form1.cs =================================================================== --- src/test_applications/tester/Form1.cs 2006-07-15 16:39:03 UTC (rev 18) +++ src/test_applications/tester/Form1.cs 2006-07-16 09:15:26 UTC (rev 19) @@ -18,6 +18,7 @@ using RPGWorldModel.Implementation.Entities.Items.Pants; using RPGWorldModel.Implementation.Entities.Items.Clubs; using RPGWorldModel.Implementation.Entities.Items.Knifes; +using RPGWorldModel.Abstracts.Support.Damage; /* * This is a simple WinForms application for testing features added to the framework. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |