#include "/players/eurale/defs.h"
#include <ansi.h>


attack_slash(str) {
int success_chance, random_nbr, spell_damage, spell_cost;
object target_obj;
string spell_name, caster_msg, target_msg, room_msg;

if(TP->query_spell_dam()) return 1;

if (TP->query_ghost()) {
  write("You can't cast spells, you're dead...\n");
  return 1; }

if (str == TPRN) {
  write("You cannot attack this one...\n");
  return 1; }


if(!str && !TP->query_attack())
{
  write("Use: slash [<who>]\n");
  return 1;
}

if(!str)
  target_obj = TP->query_attack();

if(!target_obj)
  target_obj = present(str, ROOM);

if(!target_obj && !present(str, ROOM))
{
  write("You don't see "+str+" here.\n");
  return 1;
}

if(TPXL < 5 || TPGEXP < 670 ||

  TP->query_attrib("cha") < 20 || TP->query_attrib("dex") < 20 ||
  TP->query_attrib("sta") < 20 || TP->query_attrib("mag") < 20 ||
  TP->query_attrib("str") < 20 || TP->query_attrib("wil") < 20 ||
  TP->query_attrib("luc") < 20 || TP->query_attrib("ste") < 20 ||
  TP->query_attrib("pie") < 20 || TP->query_attrib("int") < 20) {
  write("You lack the skills necessary to use that ability.\n");
  return 1; }

if(TPBPTS < 2) {
  write("You lack the blood energy to attack in this manner.\n");
  return 1; }

PFANGS->add_BLOODPTS(-2);
  /* new code to switch over to spell_object */
spell_name = "slash";
spell_damage = random(33) + 12;
spell_cost = 25;

switch(damage)
  {
    case 42..44: sm1 = HIR+"SUNDER"+NORM;  break;
    case 38..41: sm1 = HIR+"slash"+NORM;   break;
    case 32..37: sm1 = RED+"carve"+NORM;    break;
    case 20..31: sm1 = "cleave";               break;
    case 14..19: sm1 = "cut";                  break;
    case 12..13: sm1 = "gash";               break;
    }
  switch(random(4))
  {
    case 0:
      sm2="chest, spraying"+RED+" blood"+NORM+" across the room ";
      break;
    case 1:
      sm2="arm, spinning them about";
      break;
    case 2:
      sm2="leg, knocking them to the ground";
      break;
    case 3:
      sm2="neck, leaving them coughing up"+RED+" blood"+NORM+";
      break;
  }
  TP->spell_object(victim, "slash", damage, cost,
   "With vampiric speed you "+sm1+" "+(vn=(string)victim->query_name())+"'s "+sm2+".\n",
   (mn=(string)me->query_name())+" "+sm1+" you with "+sm2+".\n",
   mn+" "+sm1+" "+vn+" with "+sm2+".\n");
  TP->set_spell_dtype("other|evil");
  return 1;     
}

  

  TP->spell_object(target_obj, spell_name, spell_damage, spell_cost,
                        caster_msg, target_msg, room_msg);
  TP->set_spell_dtype("other|evil");

  return 1;
}
