Kicking

From IvanWiki
Revision as of 03:42, 13 August 2014 by 4zb4 (talk | contribs)
Jump to navigation Jump to search

Coding: This article contains code which is for experienced users only, and may reveal game secrets

Spoiler Warning: This page contains spoilers which may affect your IVAN experience negatively

//work in progress
Kicking with (k) allows the player to apply the full force of his legs upon an adjacent tile and anything that happens to be occupying it at the time.

The effect of being kicked depends on what type of entity is on the receiving end. Enemies will make a hit check for damage and being thrown off balance, items will be thrown a certain distance, and walls or other terrain objects will check for damage.

void character::BeKicked(character* Kicker, item* Boot, bodypart* Leg, v2 HitPos, double KickDamage, double ToHitValue, int Success, int Direction, truth Critical, truth ForceHit)
{
  switch(TakeHit(Kicker, Boot, Leg, HitPos, KickDamage, ToHitValue, Success, KICK_ATTACK, Direction, Critical, ForceHit))
  {
   case HAS_HIT:
   case HAS_BLOCKED:
   case DID_NO_DAMAGE:
    if(IsEnabled() && !CheckBalance(KickDamage))
    {
      if(IsPlayer())
	ADD_MESSAGE("The kick throws you off balance.");
      else if(Kicker->IsPlayer())
	ADD_MESSAGE("The kick throws %s off balance.", CHAR_DESCRIPTION(DEFINITE));

      v2 FallToPos = GetPos() + game::GetMoveVector(Direction);
      FallTo(Kicker, FallToPos);
    }
  }
}

A kick's damage is determined by the boot on the foot used, the user's base kick strength (default is double the user's unarmed strength), the user's LSTR and the user's kicking skill.

void leg::CalculateDamage()
{
  if(!Master)
    return;

  double WeaponStrength = GetBaseKickStrength() * GetBaseKickStrength();
  item* Boot = GetBoot();

  if(Boot)
    WeaponStrength += Boot->GetWeaponStrength();

  double Base = sqrt(5e-5 * WeaponStrength);

  if(Boot)
    Base += Boot->GetDamageBonus();

  KickDamage = Base * sqrt(1e-7 * GetAttribute(LEG_STRENGTH))
	       * GetHumanoidMaster()->GetCWeaponSkill(KICK)->GetBonus();
}

A kick's to-hit value is calculated using the equipped boot's to-hit bonus and the user's AGI, PER, kicking skill and burden value.

void leg::CalculateToHitValue()
{
  if(!Master)
    return;

  double BonusMultiplier = 10.;
  item* Boot = GetBoot();

  if(Boot)
    BonusMultiplier += Boot->GetTHVBonus();

  KickToHitValue = GetAttribute(AGILITY)
		   * sqrt(2.5 * Master->GetAttribute(PERCEPTION))
		   * GetHumanoidMaster()->GetCWeaponSkill(KICK)->GetBonus()
		   * Master->GetMoveEase()
		   * BonusMultiplier / 10000000;
}


Enemies

Enemies that are kicked can both be damaged by it and be thrown backward a few tiles.