
#include <lib.h>
#include <armour_types.h>
#include <armour_class.h>
#include <damage_types.h>
#include <vendor_types.h>
#include <size.h>
inherit LIB_ARMOUR;

int DoBonus();
int BonusCheck();
int RemoveBonus();

static void create() {
  ::create();
  SetKeyName("suit");
  SetArmourType(A_BODY_ARMOUR);
  SetShort("a suit of daemonic platemail");
  SetLong("This suit of platemail was made especially"
          " for Baelrot the Champion of the Pit. His"
          " blood and sweat, as well as the blood of"
          " others, cover it from top to bottom.");
  SetValue(5000);
  SetMass(200);
  SetWarmth(0);
  SetSize(SIZE_LARGE);
  SetDamagePoints(2000);
  SetId( ({ "suit", "platemail", "plate" }) );
  SetAdjectives( ({ "daemonic", "daemon" }) );
  SetMaterials( ({ "metal" }) );
  SetRepairDifficulty(40);
  SetArmourClass(ARMOUR_PLATE);
  SetWear( (: DoBonus :) );
 }


int DoBonus() {
  if ( this_player()->GetRace() == "daemon" ) {
     this_player()->AddStatBonus("strength", (: BonusCheck :) );
     this_player()->AddStatBonus("durability", (: BonusCheck :) );
     return 1;
   } 
  return 0;
}
  

int BonusCheck() {
   int amt;
   amt = (this_player()->GetLevel());
 
  if ( amt > 126 ) {
    amt = 125;
    return amt;
   }
  return amt;
}

int eventUnequip() {
  if ( this_player()->GetRace() == "daemon" ) {
     this_player()->AddStatBonus("strength", (: RemoveBonus :) );
     this_player()->AddStatBonus("durability", (: RemoveBonus :) );
     return (armour::eventUnequip());
    
   } 
  return (armour::eventUnequip());
}

int RemoveBonus() {
   int amt;
   amt = -(environment()->GetLevel());
 
  if ( amt > 126 ) {
    amt = -125;
    return amt;
   }
  return amt;
}
