04 Armor
Describes how to create armor objects and how armor works.
In Circumreality, armor is an equippable object which, when worn,
provides protection. Armor includes objects like chainmail
shirts, greaves, and helmets. Armor does not include
shields; these are considered to be weapons that parry.
Creating an armor object/class
To create a new piece of armor, such as a chainmail shirt:
-
Create a new object/class as usual.
-
Assign the cArmor superclass to it.
-
Fill in pNLPNounName and pNLPParseName,
as is typical for all objects.
-
Because armor is usually heavy and bulky, make sure
to fill in pWeightSelf and pVolumeSelf.
-
Since armor usually only fits certain-sized people,
make sure to fill
in pEquipWeightMax, pEquipWeightMin, and
maybe pEquipShape.
-
Set pEquipLoc to the armor's location,
such as [oBodyPartLocTorso, oBodyPartLocArmLeft,
oBodyPartLocArmoRight] for a chainmail shirt.
-
You need to specify how much damage the armor will absorb
by setting various pArmorXXX properties,
where XXX is
substituted. pArmorBlunt, pArmorImpale,
and pArmorSlash are the most common ones, but
other damage types exist.
-
You may also with to set pArmorAllBodyParts to
TRUE if the armor is a magical medallion that protects the
entire body, instead of just where it's worn.
-
pArmorDamageAbsorb affects how much damage the
armor can absorb before it's useless.
-
Whenever armor is hit, it will transfer some damage "energy"
into pushing damage that may knock the character over, even
if the character isn't hurt. You may want to
create magic armor that reduces the chances of
knockdown due to this effect by
setting pArmorPushScale.
Here are some things to watch out for with armor:
-
Don't forget the pEquipWeightMin and pEquipWeightMax,
because characters will be different sized.
-
The armor's pWeightSelf and pVolumeSelf will
be higher/lower for larger/smaller characters.
-
The damage absorbed will be greater/smaller for larger/smaller
suits of armor.
-
Likewise, the amount of pArmorDamageAbsorb will
vary with the size of the armor.
-
You may wish to create a class for each type of armor, such
as cArmorChainShirt, which looks
at pEquipWeightSelf, and automatically calculated
the above settings. That way, creating chainmail armor for halflings
vs. armor for humans is only a matter of chaning one parameter,
not four or five.
-
You could go one step further and include some sort of
steel-quality property that makes the armor more protective
or longer-lasting.
-
If you have non-human races that can't wear human-shaped
armor you'll need to set pEquipShape.
When a character is successfully attacked,
the DamageArmor() call will eventually be
called. (Usually after
the DamageDoge() and DamageParry() calls.)
This function looks through all the armor the character is wearing
and reducing the damage accordingly. It, in turn,
calls DamageNoArmor(), which then inflicts the damage
onto the character's body parts.
05 Weapons and shields
Information about how to create your own weapon and shield objects.
Weapons and shields are equippable objects. When the character
attacks a weapon will be chosen to use. The character can
also parry with a weapon and shield.
Creating a weapon object/class
To create a new weapon, such as a sword:
-
Create a new object/class as usual.
-
Assign the cWeapon superclass to it.
-
Fill in pNLPNounName and pNLPParseName,
as is typical for all objects.
-
Make sure
to fill in pWeightSelf and pVolumeSelf.
-
Since weapons can only be wielded by people large enough (halflings
don't do well with longswords), make sure to
set pEquipWeightMax, pEquipWeightMin, and
maybe pEquipShape.
-
By default, a weapon's pEquipLoc is set
to be single-handed. You can change this for two-handed weapons.
-
You need to specify how much damage the weapon will do
by setting pWeaponAttackDamage. This is list
of the types of attacks that a weapon can do. For example: A
sword can "swing" or "stab", swinging doing slashing damage
and stabbing doing impaling. For each attack type, you need
to supply the damage lists, with the carrier, non-carrier,
and extra damage. For a complete description see the
documentation for pWeaponAttackDamage.
If one of the damage types is "throw" then the weapon can
be thrown, like a dagger or an axe. A thrown weapon can't be
parried (except by a shield), but it must be picked up by
the attacker.
-
You'll also need to set pWeaponHitSuccessDamage to
control how much damage is done by barely-made hits. For swords,
this number would be relatively high, such as 2.0, since a
barely-made hit results in a slight gash, and only when a solid
hit results is the full damage done. For arrows, a barely-made
hit is nearly as good as a solid hit, so the value would be 0.5.
-
Set pWeaponAttackTime to the number of seconds
(optimum) between swings. Daggers will have fast attack
times, of 4 or 5 seconds, while two handed-swords will be
10-15 seconds.
-
pWeaponLength specifies the length of the weapon.
It allows characters with long weapons to attack taller characters,
like giants.
-
If it's a missle weapon, set pWeaponIsMissile. Only
shields can parry missle weapons.
-
pWeaponParry is the ability for the weapon to parry.
Use 0.0 for long swords. Daggers will have a parry closer to -1 or -2,
while shields will have a parry ability around 1.0.
If the weapon cannot parry then set this to NULL.
-
Set pWeaponSkillDamage to the skill (probably
the strength attribute) that allows the weapon to do more damage.
-
pWeaponSkillToHit should be filled with information
about the weapon's skill, such as [oSkillSwordsmanship, 0.3]. The
second entry in the list affects how many standard deviations
are added to the character's chance of hitting, per skill level.
-
If you want your weapon to be more accurate (or less accurate)
than normal, then set pWeaponAccuracy.
-
If your weapon wears out every time its used, wether or not
it hits, such as a bow, then
set pWeaponDamagedPerUse to a number like
0.001, which allows 1000 uses out of it.
Bows and arrows (or guns and bullets) are a bit trickier since the
bow is the weapon, but the arrows (or bullets) are used up for
each attack.
To create a bow:
-
Base your object on cBow instead
of cWeapon; cBow is, in turn, a sub-class of cWeapon.
-
Set all the properties that you would for a weapon.
-
Set pBowShape to a "shape" for the bow; only
arrows of the same shape as the bow can be used. For
example: You might use "longbow", "crossbow" or "10mm shell".
-
The cBow class assumes that the bow uses 1 arrow per shot.
However, if the "bow" is a squirt gun, and uses 0.1 liters
of water per shot, then set pBowUnits to 0.1.
-
If the bow stores its "arrows" internally, such as a gun,
which contains bullets in a cartridge, then you should
also base the bow off of cContainer and
set pBowArrowLoc to TRUE so the bow code knows
to look within the bow for arrows.
Setting pBowArrowLoc to FALSE, or leaving it blank, will
cause the bow to look for arrows held by the character.
You must also create arrow objects:
-
An arrow object is a subclass of cArrow.
-
Fill in pNLPNounName, pNLPParseName,
pVisual, and pExamineGeneral as
usual.
-
Make sure that pArrowShape is set to the same
string as pBowShape in the bow.
-
Arrow objects are ultimately collections. Therefore, you
need to set pCollectionType so that arrows of
the same type can be combined together.
-
Likewise, set pQuantity to the number of arrows
in the collection.
The cShield class, used for shields, is based off cWeapon.
The only difference is that cSheild sets some properties
appropriate for shields, such
as pWeaponParryMissile so the shield can parry
missile attacks, pWeaponParryAlways so
the shiled is always parrying when
equipped, pEquipOffhand so it's equipped in
the left hand,
and pWeaponSkillToHit to oSkillShield.
Here are some things to watch out for with weapons:
-
Don't forget the pEquipWeightMin and pEquipWeightMax,
because characters will be different sized.
-
You may wish to create a class for each type of weapon, such
as cWeaponSword, which looks
at pEquipWeightSelf, and automatically calculates
the above settings and the damage.
That way, creating sword for halflings
vs. a sword for humans is only a matter of changing one parameter,
not four or five.
-
You could go one step further and include some sort of
steel-quality property that makes the sword do more damage
or longer-lasting.
-
If you have non-human races that can't wield human
weapons you'll need to set pEquipShape.
Where weapons are invoked
When a character is attacked, the DamageParry() call
will be made. If the character can parry, it will be done
here. If the parry fails, then DamageDodge() is called.
Share with your friends: |