//This should be virtual. This way, if there are magical //weapons with special when equipped functions, they can //overried GetInstance, and create a new instance of //the subtype from it... public override SerializedObject GetInstance() { GenericWeapon ret = new GenericWeapon(); InventoryItem.DressInstance(ret, inventoryItemWrapper as InventoryItemWrapper); GenericWeapon.DressInstance(ret, this); return(ret); }
public override SerializedObject GetInstance() { PaperDoll ret = new PaperDoll(); List <EquipmentType> armours = new List <EquipmentType> () { EquipmentType.ARMOUR_HEAVY, EquipmentType.ARMOUR_LIGHT, EquipmentType.ARMOUR_MEDIUM, EquipmentType.ARMOUR_SHIELD }; List <EquipmentType> weapons = new List <EquipmentType> () { EquipmentType.WEAPON_SIMPLE, EquipmentType.WEAPON_MARTIAL, EquipmentType.WEAPON_UNARMED }; // List<EquipmentType> shields = new List<EquipmentType> () { // EquipmentType.ARMOUR_SHIELD // }; for (int i = 0; i < equipment.Length; i++) { //notice the equipment doesn't get equipped, which means //the parent sheet will need to worry about that for itself. if (armours.Contains(equipmentTypes [i])) { GenericArmourWrapper wrap = (GenericArmourWrapper)equipment [i]; GenericArmour e = (GenericArmour)wrap.GetInstance(); ret.slots.Add(slots [i], e); } else if (weapons.Contains(equipmentTypes [i])) { GenericWeaponWrapper wrap = (GenericWeaponWrapper)equipment [i]; GenericWeapon e = (GenericWeapon)wrap.GetInstance(); ret.slots.Add(slots [i], e); } //this should not be nessecary.... // else if (shields.Contains(equipmentTypes [i])) { // //throw new UnityException ("No generic subclass for shield yet. Cannot support deserialization"); // GenericShield e = (GenericShield)equipment [i].GetInstance (); // ret.slots.Add (slots [i], e); // } else { throw new UnityException("There is no case for deserializing this equipment type: " + equipmentTypes [i]); } // Equipment e = (Equipment) equipment [i].GetInstance (); } return(ret); }
public int Reach() { GenericWeapon w = MainHand(); if (w != null && w.Properties.Contains(WeaponProperty.REACH)) { return(2); } else { return(1); } }
public bool WithinAttackRangeOf(Actor a) { bool reach = WithinReach(a); if (reach) { return(true); } if (a.CharSheet.MainHand().IsRanged() || a.CharSheet.MainHand().IsThrown()) { int cost = this.HCostTo(a.GetComponent <TileMovement>().occupying); AT.Character.GenericWeapon wep = a.CharSheet.MainHand(); if (wep.MaxRng >= cost) { return(true); } } return(false); }
public Wrapper GetSerializableWrapper() { PaperDollWrapper wrap = new PaperDollWrapper(); wrap.equipment = new Wrapper[slots.Count]; wrap.slots = new EquipmentSlotType[slots.Count]; wrap.equipmentTypes = new EquipmentType[slots.Count]; List <EquipmentSlotType> types = new List <EquipmentSlotType> (); int i = 0; foreach (EquipmentSlotType s in slots.Keys) { wrap.slots [i] = s; Equipment equipped = slots [s]; if (equipped is GenericArmour) { GenericArmour arm = (GenericArmour)equipped; wrap.equipment [i] = arm.GetSerializableWrapper(); } else if (equipped is GenericWeapon) { GenericWeapon weap = (GenericWeapon)equipped; wrap.equipment [i] = weap.GetSerializableWrapper(); } else { Debug.LogError("Not yet supporting serialization for " + equipped.GetType()); } wrap.equipmentTypes [i] = equipped.Type; i++; } return(wrap); }
private void Add2IfOneHandedNoOtherWeapons(Character.Effect.PhysicalDamage effect, AttackSituation sit, bool offhand) { if (sit.WeaponUsed == null) { // Debug.LogError("thing again"); } if (sit.WeaponUsed.Properties.Contains(WeaponProperty.HEAVY)) { return; } GenericWeapon mainhand = sit.Attacker.MainHand(); Equipment off_hand = sit.Attacker.OffHand(); // Debug.LogError ("hfosdoih attack ?"); if (mainhand == sit.WeaponUsed) { if (off_hand is GenericWeapon || mainhand.Subtype == EquipmentSubtype.SIMPLE_FIST) { return; } else { // Debug.LogError ("yes!"); effect.Gauge.Modify(new Modifier(2, "Dueling")); } } else { if (sit.Attacker.MainHand().Subtype == EquipmentSubtype.SIMPLE_FIST) //no other weapon is present. // Debug.LogError ("yes!"); { effect.Gauge.Modify(new Modifier(2, "Dueling")); } } }
public PaperDoll() { slots = new Dictionary <EquipmentSlotType, Equipment> (); fistWeapon = new Unarmed(); }
public static void DressInstance(GenericWeapon weapon, GenericWeaponWrapper wrap) { GenericWeapon.SetWeaponProperties(weapon, wrap.subtype); }
public Dagger() : base() { GenericWeapon.SetWeaponProperties(this, EquipmentSubtype.SIMPLE_DAGGER); }
public Handaxe() : base() { GenericWeapon.SetWeaponProperties(this, EquipmentSubtype.SIMPLE_HANDAXE); }
public Unarmed() : base() { GenericWeapon.SetWeaponProperties(this, EquipmentSubtype.SIMPLE_FIST); }
public Longsword() : base() { GenericWeapon.SetWeaponProperties(this, EquipmentSubtype.MARTIAL_LONGSWORD); }
public Club() : base() { GenericWeapon.SetWeaponProperties(this, EquipmentSubtype.SIMPLE_CLUB); }
/// <summary> /// Weapon property table. Sets the basic properties for the equipment subtype. /// To see how enchantments are stored and set, see the Set Weapon enchantment types. /// </summary> /// <param name="weapon">Weapon.</param> /// <param name="t">T.</param> public static void SetWeaponProperties(GenericWeapon weapon, EquipmentSubtype t) { weapon.FittingSlotTypes = new List <EquipmentSlotType> () { EquipmentSlotType.MAIN_HAND }; weapon.OffhandAnimationControllerName = EquipmentAnimationControllerName.NOT_SET; weapon.SwingSoundFX = AT.WeaponSwingFXType.NONE; switch (t) { case EquipmentSubtype.SIMPLE_CLUB: weapon.Subtype = EquipmentSubtype.SIMPLE_CLUB; weapon.Type = EquipmentType.WEAPON_SIMPLE; weapon.Dice = new int[] { 6 }; weapon.DamageType = DamageType.BLUDGEONING; weapon.Worth = 5; weapon.Properties.Add(WeaponProperty.LIGHT); weapon.FittingSlotTypes.Add(EquipmentSlotType.OFF_HAND); weapon.SwingSoundFX = AT.WeaponSwingFXType.LIGHT; break; case EquipmentSubtype.SIMPLE_DAGGER: weapon.Type = EquipmentType.WEAPON_SIMPLE; weapon.Subtype = EquipmentSubtype.SIMPLE_DAGGER; weapon.Dice = new int[] { 4 }; weapon.DamageType = DamageType.PIERCING; weapon.NormRng = 4; weapon.MaxRng = 12; weapon.Properties.Add(WeaponProperty.THROWN); weapon.Properties.Add(WeaponProperty.LIGHT); weapon.Properties.Add(WeaponProperty.FINESSE); weapon.AnimationControllerName = EquipmentAnimationControllerName.MAINHAND_DAGGER; weapon.OffhandAnimationControllerName = EquipmentAnimationControllerName.OFFHAND_DAGGER; weapon.IconType = IconName.DAGGER; weapon.MissileAnimationName = MissileScript.MissileAnimationName.DAGGER; weapon.FittingSlotTypes.Add(EquipmentSlotType.OFF_HAND); weapon.SwingSoundFX = AT.WeaponSwingFXType.LIGHT; break; case EquipmentSubtype.SIMPLE_HANDAXE: weapon.Type = EquipmentType.WEAPON_SIMPLE; weapon.Subtype = EquipmentSubtype.SIMPLE_HANDAXE; weapon.Dice = new int[] { 6 }; weapon.DamageType = DamageType.SLASHING; weapon.NormRng = 4; weapon.MaxRng = 12; weapon.AnimationControllerName = EquipmentAnimationControllerName.MAINHAND_HANDAXE; weapon.OffhandAnimationControllerName = EquipmentAnimationControllerName.OFFHAND_HANDAXE; weapon.MissileAnimationName = MissileScript.MissileAnimationName.HANDAXE; weapon.Properties.Add(WeaponProperty.THROWN); weapon.Properties.Add(WeaponProperty.LIGHT); weapon.IconType = IconName.HANDAXE; weapon.FittingSlotTypes.Add(EquipmentSlotType.OFF_HAND); weapon.SwingSoundFX = AT.WeaponSwingFXType.LIGHT; break; case EquipmentSubtype.MARTIAL_LONGSWORD: weapon.Subtype = EquipmentSubtype.MARTIAL_LONGSWORD; weapon.Type = EquipmentType.WEAPON_MARTIAL; weapon.Dice = new int[] { 8 }; weapon.DamageType = DamageType.SLASHING; weapon.Properties.Add(WeaponProperty.VERSATILE); weapon.AnimationControllerName = EquipmentAnimationControllerName.MAINHAND_LONGSWORD; weapon.IconType = IconName.SWORD_BLACK; weapon.SwingSoundFX = AT.WeaponSwingFXType.MEDIUM; break; case EquipmentSubtype.SIMPLE_FIST: weapon.Subtype = EquipmentSubtype.SIMPLE_FIST; weapon.Type = EquipmentType.WEAPON_UNARMED; weapon.Dice = new int[] { 1 }; weapon.DamageType = DamageType.BLUDGEONING; weapon.SwingSoundFX = AT.WeaponSwingFXType.LIGHT; break; default: Debug.LogError("issue. type was not valid: " + t); break; } }