Did it this way because we need to run it on a different function than just rarity--it really needs to be tailored to the level of the enemy and carefully balanced against the types of armor that should be appearing in those groups.
//TY adding below code to give armor to AI enemies characters, AD&D equipment table style. Balanced together with the weapon changes which should reduce AI damage dealing in the higher levels.
float armorroll = frnd()
if(isWeapons)
{
if(!CheckAttribute(chr,"isIndian"))
{
if(rank >= 1 && rank <= 10)
{ if (armorroll < 0.3)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.3 && armorroll < 0.34)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.34 && armorroll < 0.35)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.35 && armorroll < 0.36)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 11 && rank <= 15)
{ if (armorroll < 0.3)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.3 && armorroll < 0.4)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.4 && armorroll < 0.46)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.46 && armorroll < 0.47)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 16 && rank <= 20)
{ if (armorroll < 0.4)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.4 && armorroll < 0.5)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.5 && armorroll < 0.65)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.65 && armorroll < 0.66)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 21 && rank <= 25)
{ if (armorroll < 0.4)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.4 && armorroll < 0.47)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.47 && armorroll < 0.67)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.67 && armorroll < 0.68)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.68 && armorroll < 0.69)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 26 && rank <= 30)
{ if (armorroll < 0.35)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.35 && armorroll < 0.45)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.45 && armorroll < 0.75)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.75 && armorroll < 0.79)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.79 && armorroll < 0.80)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 31 && rank <= 35)
{ if (armorroll < 0.35)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.35 && armorroll < 0.45)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.45 && armorroll < 0.75)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.75 && armorroll < 0.81)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.81 && armorroll < 0.814)
{
GiveItem2Character(chr, "goldarmor");
EquipCharacterByItem(chr, "goldarmor");
}
if (armorroll >= 0.814 && armorroll < 0.82)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 36 && rank <= 40)
{ if (armorroll < 0.35)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.35 && armorroll < 0.45)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.45 && armorroll < 0.75)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.75 && armorroll < 0.85)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.85 && armorroll < 0.86)
{
GiveItem2Character(chr, "goldarmor");
EquipCharacterByItem(chr, "goldarmor");
}
if (armorroll >= 0.86 && armorroll < 0.87)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 41 && rank <= 45)
{ if (armorroll < 0.35)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.35 && armorroll < 0.45)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.45 && armorroll < 0.75)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.75 && armorroll < 0.88)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.88 && armorroll < 0.89)
{
GiveItem2Character(chr, "goldarmor");
EquipCharacterByItem(chr, "goldarmor");
}
if (armorroll >= 0.89 && armorroll < 0.90)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 46 && rank <= 50)
{ if (armorroll < 0.25)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.25 && armorroll < 0.35)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.35 && armorroll < 0.75)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.75 && armorroll < 0.88)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.88 && armorroll < 0.89)
{
GiveItem2Character(chr, "goldarmor");
EquipCharacterByItem(chr, "goldarmor");
}
if (armorroll >= 0.89 && armorroll < 0.90)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
if(rank >= 51)
{ if (armorroll < 0.2)
{
GiveItem2Character(chr, "jerkin");
EquipCharacterByItem(chr, "jerkin");
}
if (armorroll >= 0.2 && armorroll < 0.27)
{
GiveItem2Character(chr, "cured");
EquipCharacterByItem(chr, "cured");
}
if (armorroll >= 0.27 && armorroll < 0.80)
{
GiveItem2Character(chr, "cheaparmor");
EquipCharacterByItem(chr, "cheaparmor");
}
if (armorroll >= 0.80 && armorroll < 0.97)
{
GiveItem2Character(chr, "commonarmor");
EquipCharacterByItem(chr, "commonarmor");
}
if (armorroll >= 0.97 && armorroll < 0.99)
{
GiveItem2Character(chr, "goldarmor");
EquipCharacterByItem(chr, "goldarmor");
}
if (armorroll >= 0.99 && armorroll < 0.995)
{
GiveItem2Character(chr, "gorget");
EquipCharacterByItem(chr, "gorget");
}
}
}
}