[Rpgworldmodel-commits] SF.net SVN: rpgworldmodel: [20] doc
Status: Inactive
Brought to you by:
deadwood_pl
From: <dea...@us...> - 2006-07-16 15:06:08
|
Revision: 20 Author: deadwood_pl Date: 2006-07-16 08:05:17 -0700 (Sun, 16 Jul 2006) ViewCVS: http://svn.sourceforge.net/rpgworldmodel/?rev=20&view=rev Log Message: ----------- Preparation for implementing IAttacker/IDefender interfaces. Modified Paths: -------------- doc/RPGWorldModel_model.zuml src/RPGWorldModel.Abstracts/Animal.cs src/RPGWorldModel.Abstracts/AnimatedEntity.cs src/RPGWorldModel.Abstracts/Arachnid.cs src/RPGWorldModel.Abstracts/Club.cs src/RPGWorldModel.Abstracts/Goblin.cs src/RPGWorldModel.Abstracts/Human.cs src/RPGWorldModel.Abstracts/Humanoid.cs src/RPGWorldModel.Abstracts/Knife.cs src/RPGWorldModel.Abstracts/LiveEntity.cs src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj src/RPGWorldModel.Abstracts/Spider.cs src/RPGWorldModel.Abstracts/Sword.cs src/RPGWorldModel.Abstracts/Weapon.cs src/RPGWorldModel.Implementation/RPGWorldModel.Implementation.csproj src/test_applications/tester/Form1.cs Added Paths: ----------- src/RPGWorldModel.Abstracts/IAttacker.cs src/RPGWorldModel.Abstracts/IDefender.cs src/RPGWorldModel.Implementation/Goblins.cs src/RPGWorldModel.Implementation/Humans.cs src/RPGWorldModel.Implementation/Spiders.cs Modified: doc/RPGWorldModel_model.zuml =================================================================== (Binary files differ) Modified: src/RPGWorldModel.Abstracts/Animal.cs =================================================================== --- src/RPGWorldModel.Abstracts/Animal.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Animal.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Abstracts.Entities.LiveEntities { @@ -18,28 +19,6 @@ } } - public override void InitializeEquip() - { - // Animals by default have no equip abilities - equipmentSlots.Clear(); - } - - public override EquipResponse Equip(EquipRequest request) - { - // Animals by default have no equip abilities - EquipResponse response = new EquipResponse(); - response.Status = EquipStatus.NotEquippedNotAbleToEquipAnyEntities; - 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-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/AnimatedEntity.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -3,14 +3,12 @@ using System.Text; using RPGWorldModel.Abstracts.Interfaces; using RPGWorldModel.Abstracts.Support.Equipment; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Abstracts.Entities { - public abstract class AnimatedEntity : GameEntity, IEquip + public abstract class AnimatedEntity : GameEntity, IDamageInflictor, IEquip, IAttacker, IDefender { - protected AnimatedEntity() - { - } #region IEquip Members @@ -21,14 +19,125 @@ get { return equipmentSlots; } } - public abstract EquipResponse Equip(EquipRequest request); + public virtual EquipResponse Equip(EquipRequest request) + { + // No equip abilities + EquipResponse response = new EquipResponse(); + response.Status = EquipStatus.NotEquippedNotAbleToEquipAnyEntities; + return response; + } - public abstract UnEquipResponse UnEquip(UnEquipRequest request); + public virtual UnEquipResponse UnEquip(UnEquipRequest request) + { + // No equip abilities + UnEquipResponse response = new UnEquipResponse(); + response.Status = UnEquipStatus.NotUnEquippedNotAbleToUnEquipAnyEntities; + return response; + } - public abstract void InitializeEquip(); + public virtual void InitializeEquip() + { + // No equip abilities + equipmentSlots.Clear(); + } #endregion + #region IAttacker Members + + public virtual AttackerInflictedDamageResponse GetAttackerInflictedDamage() + { + AttackerInflictedDamageResponse response = + new AttackerInflictedDamageResponse(); + + // Use damage decriptors from the entity itself + DamageInflictorInflictedDamageResponse responseDI = + new DamageInflictorInflictedDamageResponse(); + + foreach (InflictedDamage inflictedDamage in responseDI.InflictedDamages) + response.Set(inflictedDamage); + + return response; + } + + #endregion + + #region IDamageInflictor Members + + protected DamageDescriptorDictionary damageDescriptors = new DamageDescriptorDictionary(); + + protected virtual void addDamageDescriptorIfNotExisting(DamageDescriptor descriptor) + { + if (!damageDescriptors.ContainsKey(descriptor.GetType())) + AddDamage(descriptor); + } + + public virtual void InitializeDamageInflictor() + { + foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) + { + // Randomizing damage descriptors + if (damageDescriptor.RandomizationRequired) + randomizeDamageDescriptor(damageDescriptor); + } + } + + protected virtual void randomizeDamageDescriptor(DamageDescriptor descriptor) + { + descriptor.MinDamage = (short)basicRandomize(descriptor.BaseMinDamage, descriptor.MinDamageMargin); + descriptor.MaxDamage = (short)basicRandomize(descriptor.BaseMaxDamage, descriptor.MaxDamageMargin); + + // logic security check + if (descriptor.MinDamage > descriptor.MaxDamage) + { + short temp = descriptor.MinDamage; + descriptor.MinDamage = descriptor.MinDamage; + descriptor.MaxDamage = temp; + } + + } + + public virtual void AddDamage(DamageDescriptor descriptor) + { + damageDescriptors[descriptor.GetType()] = descriptor; + } + + public virtual void RemoveDamage(DamageDescriptor descriptor) + { + damageDescriptors.Remove(descriptor.GetType()); + } + + /// <summary> + /// Default implementation + /// </summary> + /// <returns></returns> + public virtual DamageInflictorInflictedDamageResponse GetInflictedDamage() + { + //TODO : affect damage by attributes? + + DamageInflictorInflictedDamageResponse response = + new DamageInflictorInflictedDamageResponse(); + + short min = 0; + short max = 0; + + foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) + { + InflictedDamage damage = damageDescriptor.CreateInflictedDamage(); + + min = (short)(damageDescriptor.MinDamage); + max = (short)(damageDescriptor.MaxDamage); + + damage.SetDamage(min, max); + + response.Set(damage); + } + + return response; + } + + #endregion + #region Initialize Overrides public override void InitializeEntity() @@ -36,6 +145,8 @@ base.InitializeEntity(); InitializeEquip(); + + InitializeDamageInflictor(); } public override void InitializeNamedEntity() Modified: src/RPGWorldModel.Abstracts/Arachnid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Arachnid.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Arachnid.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -6,5 +6,17 @@ { public abstract class Arachnid : Animal { + #region Initialize Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Unknown Arachnid Entity"; + name.IsInitialized = true; + } + } + + #endregion } } Modified: src/RPGWorldModel.Abstracts/Club.cs =================================================================== --- src/RPGWorldModel.Abstracts/Club.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Club.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -19,28 +19,6 @@ } } - public override void InitializeDamageInflictor() - { - // Preadding required descriptors - addDamageDescriptorIfNotExisting(new DamageDescriptorPhysical()); - - foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) - { - if (!damageDescriptor.IsInitialized && damageDescriptor is DamageDescriptorPhysical) - { - damageDescriptor.BaseMinDamage = 0; - damageDescriptor.MinDamageMargin = 0; - damageDescriptor.BaseMaxDamage = 0; - damageDescriptor.MaxDamageMargin = 0; - damageDescriptor.IsInitialized = true; - damageDescriptor.RandomizationRequired = true; - } - - if (damageDescriptor.RandomizationRequired) - randomizeDamageDescriptor(damageDescriptor); - } - } - public override void InitializeEquipable() { equipmentLocationDescriptors.Clear(); Modified: src/RPGWorldModel.Abstracts/Goblin.cs =================================================================== --- src/RPGWorldModel.Abstracts/Goblin.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Goblin.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -3,14 +3,12 @@ using System.Text; using RPGWorldModel.Abstracts.Entities.LiveEntities; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.LiveEntities { public class Goblin : Humanoid { - public Goblin() - { - } #region Initialize Overrides @@ -27,17 +25,30 @@ { if (!hp.IsInitialized) { - // Base values for goblin - hp.BaseHP = 80; - hp.HPMargin = 20; + hp.BaseHP = 0; + hp.HPMargin = 0; hp.IsInitialized = true; hp.RandomizationRequired = true; } - if (hp.RandomizationRequired) - randomizeMaxHealthPoints(); + base.InitializeLiveEntity(); } + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 0; + phy.BaseMinDamage = 0; + phy.MaxDamageMargin = 0; + phy.MinDamageMargin = 0; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + #endregion Modified: src/RPGWorldModel.Abstracts/Human.cs =================================================================== --- src/RPGWorldModel.Abstracts/Human.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Human.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -3,14 +3,12 @@ using System.Text; using RPGWorldModel.Abstracts.Entities.LiveEntities; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.LiveEntities { public class Human : HumanoidAdvanced { - public Human() - { - } #region Initialize Overrides @@ -27,17 +25,30 @@ { if (!hp.IsInitialized) { - // Base values for human - hp.BaseHP = 100; - hp.HPMargin = 30; + hp.BaseHP = 0; + hp.HPMargin = 0; hp.IsInitialized = true; hp.RandomizationRequired = true; } - if (hp.RandomizationRequired) - randomizeMaxHealthPoints(); + base.InitializeLiveEntity(); } + + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 0; + phy.BaseMinDamage = 0; + phy.MaxDamageMargin = 0; + phy.MinDamageMargin = 0; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + #endregion } } Modified: src/RPGWorldModel.Abstracts/Humanoid.cs =================================================================== --- src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Humanoid.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -3,6 +3,7 @@ using System.Text; using RPGWorldModel.Abstracts.Interfaces; using RPGWorldModel.Abstracts.Support.Equipment; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.Abstracts.Entities.LiveEntities { @@ -42,7 +43,6 @@ #endregion - public override EquipResponse Equip(EquipRequest request) { EquipResponse response = new EquipResponse(); @@ -169,6 +169,57 @@ return response; } + + public override AttackerInflictedDamageResponse GetAttackerInflictedDamage() + { + // VERY EARLY IMPLMEMENTATION + + AttackerInflictedDamageResponse response = + new AttackerInflictedDamageResponse(); + + // TEMP : check only equipment slots for IDamageInflitor entities + // TEMP : for now only items from left/right hand are counted + + // Find equipables used for attack + EquipableList usedEquipable = new EquipableList(); + + foreach (EquipmentSlot slot in equipmentSlots) + { + if ((slot is EquipmentSlotLeftHand) || + (slot is EquipmentSlotRightHand)) + { + foreach (IEquipable equipable in slot.EquippedEntities) + if (equipable is IDamageInflictor) + if (!usedEquipable.Contains(equipable)) + usedEquipable.Add(equipable); + } + } + + // Calculate final inflicted damage + + if (usedEquipable.Count > 0) + { + // TODO: use of entity attributes to modify the final result? + + foreach (IEquipable equipable in usedEquipable) + { + DamageInflictorInflictedDamageResponse responseDI = + (equipable as IDamageInflictor).GetInflictedDamage(); + + foreach (InflictedDamage inflictedDamage in responseDI.InflictedDamages) + response.Sum(inflictedDamage); + } + } + else + { + // From AnimatedEntity + response = base.GetAttackerInflictedDamage(); + } + + + + return response; + } } public abstract class HumanoidAdvanced : Humanoid Added: src/RPGWorldModel.Abstracts/IAttacker.cs =================================================================== --- src/RPGWorldModel.Abstracts/IAttacker.cs (rev 0) +++ src/RPGWorldModel.Abstracts/IAttacker.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -0,0 +1,23 @@ +using System; +using RPGWorldModel.Abstracts.Support.Damage; + +namespace RPGWorldModel.Abstracts.Interfaces +{ + /// <summary> + /// Interface for any entity that can attack another entity + /// </summary> + public interface IAttacker + { + /// <summary> + /// Returns the total inflicted damage by entity + /// </summary> + /// <returns></returns> + AttackerInflictedDamageResponse GetAttackerInflictedDamage(); + + // TODO : Get attack success/failure objects + } + + public class AttackerInflictedDamageResponse : InflictedDamageResponse + { + } +} \ No newline at end of file Added: src/RPGWorldModel.Abstracts/IDefender.cs =================================================================== --- src/RPGWorldModel.Abstracts/IDefender.cs (rev 0) +++ src/RPGWorldModel.Abstracts/IDefender.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -0,0 +1,11 @@ +using System; + +namespace RPGWorldModel.Abstracts.Interfaces +{ + /// <summary> + /// Interface for any entity that can defend (accept) and attack + /// </summary> + public interface IDefender + { + } +} \ No newline at end of file Modified: src/RPGWorldModel.Abstracts/Knife.cs =================================================================== --- src/RPGWorldModel.Abstracts/Knife.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Knife.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -19,28 +19,6 @@ } } - public override void InitializeDamageInflictor() - { - // Preadding required descriptors - addDamageDescriptorIfNotExisting(new DamageDescriptorPhysical()); - - foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) - { - if (!damageDescriptor.IsInitialized && damageDescriptor is DamageDescriptorPhysical) - { - damageDescriptor.BaseMinDamage = 0; - damageDescriptor.MinDamageMargin = 0; - damageDescriptor.BaseMaxDamage = 0; - damageDescriptor.MaxDamageMargin = 0; - damageDescriptor.IsInitialized = true; - damageDescriptor.RandomizationRequired = true; - } - - if (damageDescriptor.RandomizationRequired) - randomizeDamageDescriptor(damageDescriptor); - } - } - public override void InitializeEquipable() { equipmentLocationDescriptors.Clear(); Modified: src/RPGWorldModel.Abstracts/LiveEntity.cs =================================================================== --- src/RPGWorldModel.Abstracts/LiveEntity.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/LiveEntity.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -10,12 +10,7 @@ /// </summary> public abstract class LiveEntity : AnimatedEntity, ILiveEntity { - protected HealthPoints hp = new HealthPoints(); - protected LiveEntity() - { - } - #region Initialize Overrides public override void InitializeEntity() @@ -38,6 +33,8 @@ #region ILiveEntity Members + protected HealthPoints hp = new HealthPoints(); + public short MaxHealthPoints { get { return hp.MaxHP; } @@ -71,8 +68,21 @@ hp.CurrentHP = hp.CurrentMaxHP = hp.MaxHP; } - public abstract void InitializeLiveEntity(); + public virtual void InitializeLiveEntity() + { + if (!hp.IsInitialized) + { + // Base values for spider + hp.BaseHP = 0; + hp.HPMargin = 0; + hp.IsInitialized = true; + hp.RandomizationRequired = true; + } + if (hp.RandomizationRequired) + randomizeMaxHealthPoints(); + } + public virtual void SetHealthPoints(HealthPoints newHealthPoints) { if (newHealthPoints == null) Modified: src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj =================================================================== --- src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/RPGWorldModel.Abstracts.csproj 2006-07-16 15:05:17 UTC (rev 20) @@ -45,8 +45,10 @@ <Compile Include="Goblin.cs" /> <Compile Include="Human.cs" /> <Compile Include="Humanoid.cs" /> + <Compile Include="IAttacker.cs" /> <Compile Include="IDamagable.cs" /> <Compile Include="IDamageInflictor.cs" /> + <Compile Include="IDefender.cs" /> <Compile Include="IEquip.cs" /> <Compile Include="IEquipable.cs" /> <Compile Include="ILiveEntity.cs" /> Modified: src/RPGWorldModel.Abstracts/Spider.cs =================================================================== --- src/RPGWorldModel.Abstracts/Spider.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Spider.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -3,6 +3,7 @@ using System.Text; using RPGWorldModel.Abstracts.Entities.LiveEntities; using RPGWorldModel.Abstracts.Interfaces; +using RPGWorldModel.Abstracts.Support.Damage; namespace RPGWorldModel.TopLevelImplementation.Entities.LiveEntities { @@ -24,15 +25,30 @@ if (!hp.IsInitialized) { // Base values for spider - hp.BaseHP = 40; - hp.HPMargin = 10; + hp.BaseHP = 0; + hp.HPMargin = 0; hp.IsInitialized = true; hp.RandomizationRequired = true; } - if (hp.RandomizationRequired) - randomizeMaxHealthPoints(); + base.InitializeLiveEntity(); } + + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 0; + phy.BaseMinDamage = 0; + phy.MaxDamageMargin = 0; + phy.MinDamageMargin = 0; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + #endregion } Modified: src/RPGWorldModel.Abstracts/Sword.cs =================================================================== --- src/RPGWorldModel.Abstracts/Sword.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Sword.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -21,28 +21,6 @@ } } - public override void InitializeDamageInflictor() - { - // Preadding required descriptors - addDamageDescriptorIfNotExisting(new DamageDescriptorPhysical()); - - foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) - { - if (!damageDescriptor.IsInitialized && damageDescriptor is DamageDescriptorPhysical) - { - damageDescriptor.BaseMinDamage = 0; - damageDescriptor.MinDamageMargin = 0; - damageDescriptor.BaseMaxDamage = 0; - damageDescriptor.MaxDamageMargin = 0; - damageDescriptor.IsInitialized = true; - damageDescriptor.RandomizationRequired = true; - } - - if (damageDescriptor.RandomizationRequired) - randomizeDamageDescriptor(damageDescriptor); - } - } - public override void InitializeEquipable() { equipmentLocationDescriptors.Clear(); Modified: src/RPGWorldModel.Abstracts/Weapon.cs =================================================================== --- src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Abstracts/Weapon.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -33,7 +33,15 @@ #region IDamageInflictor Members - public abstract void InitializeDamageInflictor(); + public virtual void InitializeDamageInflictor() + { + foreach (DamageDescriptor damageDescriptor in damageDescriptors.Values) + { + // Randomizing damage descriptors + if (damageDescriptor.RandomizationRequired) + randomizeDamageDescriptor(damageDescriptor); + } + } public virtual void AddDamage(DamageDescriptor descriptor) { Added: src/RPGWorldModel.Implementation/Goblins.cs =================================================================== --- src/RPGWorldModel.Implementation/Goblins.cs (rev 0) +++ src/RPGWorldModel.Implementation/Goblins.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -0,0 +1,50 @@ +using System; +using RPGWorldModel.TopLevelImplementation.Entities.LiveEntities; +using RPGWorldModel.Abstracts.Support.Damage; + +namespace RPGWorldModel.Implementation.Entities.LiveEntities.Goblins +{ + public class GoblinWarrior : Goblin + { + + #region Initialize Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Goblin Warrior"; + name.IsInitialized = true; + } + } + + public override void InitializeLiveEntity() + { + if (!hp.IsInitialized) + { + hp.BaseHP = 80; + hp.HPMargin = 20; + hp.IsInitialized = true; + hp.RandomizationRequired = true; + } + + base.InitializeLiveEntity(); + } + + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 10; + phy.BaseMinDamage = 5; + phy.MaxDamageMargin = 15; + phy.MinDamageMargin = 20; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + #endregion + } +} \ No newline at end of file Added: src/RPGWorldModel.Implementation/Humans.cs =================================================================== --- src/RPGWorldModel.Implementation/Humans.cs (rev 0) +++ src/RPGWorldModel.Implementation/Humans.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -0,0 +1,97 @@ +using System; +using RPGWorldModel.TopLevelImplementation.Entities.LiveEntities; +using RPGWorldModel.Abstracts.Support.Damage; + +namespace RPGWorldModel.Implementation.Entities.LiveEntities.Humans +{ + public class HumanSoldier : Human + { + #region Initialize Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Human Soldier"; + name.IsInitialized = true; + } + } + + public override void InitializeLiveEntity() + { + if (!hp.IsInitialized) + { + hp.BaseHP = 100; + hp.HPMargin = 30; + hp.IsInitialized = true; + hp.RandomizationRequired = true; + } + + base.InitializeLiveEntity(); + } + + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 15; + phy.BaseMinDamage = 5; + phy.MaxDamageMargin = 10; + phy.MinDamageMargin = 10; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + + #endregion + } + + public class HumanPlayerCharacter : Human + { + #region Initialize Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Human Player Character"; + name.IsInitialized = true; + } + } + + public override void InitializeLiveEntity() + { + // TODO : based on stats, etc + if (!hp.IsInitialized) + { + hp.BaseHP = 100; + hp.HPMargin = 0; + hp.CurrentMaxHP = hp.CurrentHP = 100; + hp.IsInitialized = true; + hp.RandomizationRequired = false; + } + + base.InitializeLiveEntity(); + } + + public override void InitializeDamageInflictor() + { + // TODO : based on stats + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 15; + phy.BaseMinDamage = 5; + phy.MaxDamageMargin = 0; + phy.MinDamageMargin = 0; + phy.IsInitialized = true; + phy.RandomizationRequired = false; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + + #endregion + } +} \ No newline at end of file Modified: src/RPGWorldModel.Implementation/RPGWorldModel.Implementation.csproj =================================================================== --- src/RPGWorldModel.Implementation/RPGWorldModel.Implementation.csproj 2006-07-16 09:15:26 UTC (rev 19) +++ src/RPGWorldModel.Implementation/RPGWorldModel.Implementation.csproj 2006-07-16 15:05:17 UTC (rev 20) @@ -34,10 +34,13 @@ </ItemGroup> <ItemGroup> <Compile Include="Clubs.cs" /> + <Compile Include="Goblins.cs" /> + <Compile Include="Humans.cs" /> <Compile Include="Knifes.cs" /> <Compile Include="Pants.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Shirts.cs" /> + <Compile Include="Spiders.cs" /> <Compile Include="Swords.cs" /> </ItemGroup> <ItemGroup> Added: src/RPGWorldModel.Implementation/Spiders.cs =================================================================== --- src/RPGWorldModel.Implementation/Spiders.cs (rev 0) +++ src/RPGWorldModel.Implementation/Spiders.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -0,0 +1,52 @@ +using System; +using RPGWorldModel.TopLevelImplementation.Entities.LiveEntities; +using RPGWorldModel.Abstracts.Support.Damage; + +namespace RPGWorldModel.Implementation.Entities.LiveEntities.Spiders +{ + public class SmallSpider : Spider + { + #region Initialize Overrides + + public override void InitializeNamedEntity() + { + if (!name.IsInitialized) + { + name.Value = "Small Spider"; + name.IsInitialized = true; + } + } + + public override void InitializeLiveEntity() + { + if (!hp.IsInitialized) + { + // Base values for spider + hp.BaseHP = 20; + hp.HPMargin = 10; + hp.IsInitialized = true; + hp.RandomizationRequired = true; + } + + base.InitializeLiveEntity(); + } + + public override void InitializeDamageInflictor() + { + DamageDescriptor phy = new DamageDescriptorPhysical(); + phy.BaseMaxDamage = 7; + phy.BaseMinDamage = 3; + phy.MaxDamageMargin = 20; + phy.MinDamageMargin = 10; + phy.IsInitialized = true; + phy.RandomizationRequired = true; + + addDamageDescriptorIfNotExisting(phy); + + base.InitializeDamageInflictor(); + } + + #endregion + + } +} \ No newline at end of file Modified: src/test_applications/tester/Form1.cs =================================================================== --- src/test_applications/tester/Form1.cs 2006-07-16 09:15:26 UTC (rev 19) +++ src/test_applications/tester/Form1.cs 2006-07-16 15:05:17 UTC (rev 20) @@ -19,6 +19,9 @@ using RPGWorldModel.Implementation.Entities.Items.Clubs; using RPGWorldModel.Implementation.Entities.Items.Knifes; using RPGWorldModel.Abstracts.Support.Damage; +using RPGWorldModel.Implementation.Entities.LiveEntities.Spiders; +using RPGWorldModel.Implementation.Entities.LiveEntities.Goblins; +using RPGWorldModel.Implementation.Entities.LiveEntities.Humans; /* * This is a simple WinForms application for testing features added to the framework. @@ -86,13 +89,13 @@ switch (enemySelect) { case(0): - enemy = new Goblin(); + enemy = new GoblinWarrior(); break; case(1): - enemy = new Human(); + enemy = new HumanSoldier(); break; case(2): - enemy = new Spider(); + enemy = new SmallSpider(); break; } @@ -100,7 +103,7 @@ - player = new Human(); + player = new HumanPlayerCharacter(); Name name = new Name(); name.Value = "Player"; name.IsInitialized = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |