Example #1
0
File: _lore.c Project: ehershey/pd
int cmd_lore(string str) {
    object ob;
    object *inv;
    int i, skip, which, conjure;
    string what, clas;
    mixed *arr;

   if (!spell()) {
      return 0;
   }
    if(!str) {
        notify_fail("Gather lore about what?\n");
        return 0;
    }
    clas = (string)this_player()->query_class();
    if(clas != "mage") {
        notify_fail("Your mind boggles in confusion.\n");
        return 0;
    }
    ob = present(str, this_player());
    if(!ob) {
        inv = all_inventory(this_player());
        if(sscanf(str, "%s %d", what, which) != 2) {
            notify_fail("You don't have that!\n");
            return 0;
        }
        for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
            if(inv[i]->id(what)) {
                skip ++;
                if(skip == which) ob = inv[i];
            }
        }
        if(!ob) {
            notify_fail("You don't have that!\n");
            return 0;
        }
    }
    conjure = (int)this_player()->query_skill("conjuring");
    if((int)this_player()->query_mp() < 13) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    say(this_player()->query_cap_name()+" mutters quietly as "+
        this_player()->query_subjective()+" focuses on the "+
        (string)ob->query_name()+".", this_player());

  this_player()->set_magic_round();
  this_player()->add_mp(-13);
  this_player()->add_skill_points("conjuring", random(13));

  write(query_output(this_player(), ob));
  return 1;
}
Example #2
0
int cmd_drown(string str) {
  object tp=this_player();
  object ob, drownob;
  int wis, ma, nat, wisdom, md, rounds, damage;
  
  if (!spell()) return 0;
  
  if (tp->query_disable()) return 1;

  if (environment(tp)->query_property("no magic") ||
      environment(tp)->query_property("no attack"))
    BAIL("You cannot cast that here.\n");

  if (!str) ob=tp->query_current_attacker();
  else ob=present(str,environment(tp));

  if (!ob)
    BAIL("You don't see that here.\n");

  if (!living(ob))
    BAIL("That is not alive.\n");

  if (tp == ob)
    BAIL("Gurgle gurgle.\n");

  if (!tp->kill_ob(ob))
    BAIL("That cannot be attacked by you yet.\n");


  wis=tp->query_stats("wisdom");
  ma=tp->query_skill("magic attack");
  nat=tp->query_skill("nature");
  
  wisdom=ob->query_stats("wisdom");
  md=ob->query_skill("magic defense");

  damage=nat/3+ma/3+wis;
  damage-=(wisdom/2+md/3);
  if (damage < 5) damage=5;

  rounds=(nat-155)/60+wis/25+2;

  if (tp->query_mp() < damage/5)
    BAIL("Too low on magic power.\n");

  tp->add_mp(-(damage/5+random(20)));

  message("info","%^BOLD%^%^CYAN%^You create a sphere of water around "+ob->query_cap_name()+".%^RESET%^", tp);
  message("info","%^BOLD%^%^CYAN%^"+tp->query_cap_name()+" creates a sphere of water around you!%^RESET%^", ob);
  message("info","%^BOLD%^%^CYAN%^"+tp->query_cap_name()+" creates a sphere of water around "+
    ob->query_cap_name()+"!%^RESET%^", environment(tp), ({tp,ob}) );
Example #3
0
	void load_spells_cfg( const char* path, Plib::Package* pkg )
	{
      Clib::ConfigFile cf( path, "Spell" );
      Clib::ConfigElem elem;

	  while ( cf.read( elem ) )
	  {
		std::unique_ptr<USpell> spell( new USpell( elem, pkg ) );

		unsigned short spellid = spell->spell_id();

		register_spell( spell.release(), spellid );
	  }
	}
Example #4
0
void send_save_spell(uint16 spellnum)
{
	buffer_t buffer;

	clear_buffer(&buffer);

	add_opcode(&buffer, CSAVESPELL);
	add_buffer(&buffer, &spellnum, SIZE16);
	add_string(&buffer,spell(spellnum)->name);
	add_buffer(&buffer, &spell(spellnum)->pic, SIZE16);
	add_buffer(&buffer, &spell(spellnum)->mpreq, SIZE16);
	add_buffer(&buffer, &spell(spellnum)->jobreq, SIZE8);
	add_buffer(&buffer, &spell(spellnum)->levelreq, SIZE8);
	add_buffer(&buffer, &spell(spellnum)->type, SIZE8);
	add_buffer(&buffer, &spell(spellnum)->data1, SIZE16);
	add_buffer(&buffer, &spell(spellnum)->data2, SIZE16);
	add_buffer(&buffer, &spell(spellnum)->data3, SIZE16);

	send_data(&buffer);
}
Example #5
0
int cmd_flamewall(string str) {

  object tp=this_player();
  object env=environment(tp);
  object fw;
  int py, md, intel;
  
  if (!spell()) return 0;
  if (tp->query_disable()) return 1;

  if (env->query_property("no attack") ||
      env->query_property("no magic"))
    BAIL("You cannot cast that here.\n");

  if (present("flamewallobj",env))
    BAIL("There is already a flamewall here!\n");

  py= tp->query_skill("pyromancy");
  md= tp->query_skill("magic defense");
  intel= tp->query_stats("intelligence");

  if (tp->query_mp() < (py+md+intel)*2/5)
    BAIL("You are too low on magic.\n");
  
  tp->add_mp(-(py+md+intel)*2/5+random(50));

  message("info","%^BOLD%^You wave your hand in a circle and "
    "a %^RED%^ring of flame%^RESET%^%^BOLD%^ shoots up around you!",tp);
  message("info","%^BOLD%^"+tp->query_cap_name()+" waves "+
    tp->query_possessive()+" hand around and a %^RED%^ring of flame"
    "%^RESET%^%^BOLD%^ shoots up around "+tp->query_objective()+"!",
    env, tp);
  
  tp->add_skill_points("pyromancy",md/20);
  tp->add_skill_points("magic defense",py/30);  

  fw=new(PLACE"flamewallobj");
  fw->set_owner(tp);
  fw->set_strength(py/3+md/4+intel*3/2);
  fw->set_time(py/30+md/25+3+random(3));
  fw->move(env);
  fw->heart_beat();

  return 1;

}
Example #6
0
int cmd_bisonsmight(string str) {
  object tp = this_player();
  object env = environment(tp);
  object tgt;
  int time, cost, defense, melee, constitution;

  if (!spell()) return 0;

  if (str) {
    if (str == "me" || str == "myself")
      tgt = tp;
    else
      tgt = present(str, env);
  }

  if (!can_cast(tp, tgt)) return 0;

  defense = tp->query_base_skill("nature")/5;
  constitution = tp->query_base_stats("wisdom")/4;
  time = tp->query_base_stats("wisdom")*7 +
         random(tp->query_base_stats("intelligence")*4);

  cost = (defense+time)/2;

  if (tp->query_mp() < cost)
    FAIL("Too low on magic.");

  tp->set_magic_round(1);
  tp->add_mp(-cost);
  tp->add_skill_points("nature", time/20 + 2);

  message("magic", COL+"You call upon the primal nature of the "+
                   COL2+"mighty bison"+COL+"!"+RES, tp);
  message("magic", COL+tp->query_cap_name()+" calls upon the primal nature "
                   "of the "+COL2+"mighty bison"+COL+"!"+RES, env, tp);

  message("magic", COL+"You feel the power of the "+COL2+"mighty bison "+
                   COL+"enter your body!"+RES, tgt);
  message("magic", COL+tp->query_cap_name()+" seems to look sturdier."+RES,
                   env, tgt);

  start_buff(tp, tgt, time, defense, constitution);
  
  return 1;
}
Example #7
0
SpellEntry* Cast(Player*player,Item* item, uint32 spellId)
{

    SpellEntry *spellInfo = sSpellStore.LookupEntry(spellId);
    if(!spellInfo)
    {
        sLog.outError("WORLD: unknown spell id %i", spellId);
        return NULL;
    }
    Spell spell(player, spellInfo, true, 0);

    SpellCastTargets targets;
    targets.setUnitTarget( player );
    spell.m_CastItem = item;
    spell.prepare(&targets);
    return spellInfo;

}
Example #8
0
int cmd_rapture(string str) {
    object env;
    object *inv;
    int i, tmp;

   if (!spell()) {
      write("Only those of great faith can cast this spell.");
      return 1;
   }
    if(str) return 0;
    env = environment(this_player());
    if(!env) return 0;
    if(this_player()->query_ghost()) {
        notify_fail("Bah! You have already experienced rapture!\n");
        return 0;
    }
    if(env->query_property("no magic") || env->query_property("no attack")) {
        notify_fail("A holy force prevents the rapture.\n");
        return 0;
    }
    if((int)this_player()->query_mp() < 20) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    if((int)this_player()->query_skill("faith") < 65) {
        notify_fail("You do not have the faith to bring about rapture.\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    for(i=0, tmp =sizeof((inv=users())); i<tmp; i++) {
        if(inv[i]->query_blocked("shout")) continue;
        if(!inv[i]->query_ansi()) tell_object(inv[i],
          "%^RED%^The air begins to thicken and bleed red with impending death through rapture.\n%^RESET%^");
        else tell_object(inv[i], red("The air begins to thicken and bleed red with impending death through rapture.\n"));
    }
    this_player()->set_magic_round();
    call_out("do_rapture", 7, env);
    this_player()->add_mp(-(int)this_player()->query_mp()); //abuse fix 930907 blodgett
    this_player()->set_paralyzed(8);
    return 1;
}
Example #9
0
// which_s = 0 means that it returns first 4th level spell
cItemRec store_priest_spells(short which_s)
{
	cItemRec spell('spel');// = {21,0, 0,0,0,0,0,0, 53,0,0,0,0, 0, 0,0, {0,0},"", "",0,0,0,0};
	static const short cost[32] = {
		100,150,75,400,200, 100,80,250,
		400,400,1200,600,300, 600,350,250,
		500,500,600,800, 1000,900,400,600,
		2500,2000,4500,4500,3000,3000,2000,2000
	};
	char str[255];

	if (which_s != minmax(0,31,which_s))
		which_s = 0;
	spell.item_level = which_s + 30;
	spell.value = cost[which_s];
	get_str((unsigned char*)str,38,which_s + 50);
	spell.full_name = str;
	return spell;
}
Example #10
0
cItemRec store_alchemy(short which_s)
{
	cItemRec spell('spel');// = {21,0, 0,0,0,0,0,0, 53,0,0,0,0, 0, 0,0, {0,0},"", "",0,0,0,0};
	static const short val[20] = {
		50,75,30,130,100,
		150, 200,200,300,250,
		300, 500,600,750,700,
		1000,10000,5000,7000,12000
	};
	char str[255];
	
	if (which_s != minmax(0,19,which_s))
		which_s = 0;
	spell.item_level = which_s;
	spell.value = val[which_s];
	get_str((unsigned char*)str,38,which_s + 100);
	spell.full_name = str;
	return spell; 
}
Example #11
0
int cmd_polymorph(string str) {
  object tp = this_player();
  object env = environment(tp);
  object tgt;
  object *allowed;
  int cost, allow;

  if (!spell()) return 0;

  if (str)
    tgt = present(str, env);
  else
    tgt = tp->query_current_attacker();

  if (!can_cast(tp, tgt)) return 0;

  cost = tp->query_skill("wizardry")/5 + random(tp->query_stats("wisdom")/2);

  if (tp->query_mp() < cost)
    FAIL("Your magic is too low.");

  allowed = tgt->query_allow("polymorph");
  if (member_array(tp->query_name(), allowed) != -1)
    allow = 1;

  if (!allow && tp != tgt &&
      (tgt->query_skill("magic defense") > tp->query_skill("conjuring") ||
      tgt->query_stats("wisdom")*3/2 > tp->query_stats("wisdom")))
        FAIL("Your magic bounces off of "+tgt->query_cap_name()+"!");

  message("magic", COL+"You move your hands in an "+intricate+COL+" pattern, "
    "and suddenly a cloud of "+COL2+"smoke"+COL+" appears around "+
    tgt->query_cap_name()+" then fades away!"+RES, tp);
  message("magic", COL+tp->query_cap_name()+" moves "+tp->query_possessive()+
    "hands in an "+intricate+COL+" pattern, "
    "and suddenly a cloud of "+COL2+"smoke"+COL+" appears around "
    "you then fades away!\n\n"+COL2
    "You feel an overwhelming urge to cluck... like a chicken."+RES, tgt);
  message("magic", COL+tp->query_cap_name()+" moves "+tp->query_possessive()+
    "hands in an "+intricate+COL+" pattern, "
    "and suddenly a cloud of "+COL2+"smoke"+COL+" appears around "+
    tgt->query_cap_name()+" then fades away!"+RES, env, ({ tp, tgt }) );
Example #12
0
int cmd_fireworks(string str) {
int mp;
 string mine, later, ours;
   if (this_player()->query_mp() < 150)
    return notify_fail("You do not have the concentration to do this.\n");
    if (!spell()) {
        return notify_fail("What?\n");
    }
   mp = this_player()->query_mp();
   if (mp >= 9000) {
     mine = "You rend the sky with your power!";
     later = "The realms shatter as you rend the skys!";
     ours = "A gargantua ball of fire launches into the sky\n"
            "%^RESET%^%^YELLOW%^The realms shatter and the skys are rended!";
   } else
   if (mp >= 2250) { 
     mine = "You summon a ball of flame and launch it into space!";
     later= "You shatter the moon with your power!";
     ours = "A great ball of flame launches into space, shattering the moon!";
   } else
   if (mp >= 1500) {
     mine = "You light up the sky with flames!";
     later = "Your ball of fire dwarfs the sun.";
     ours = "A huge ball of fire lights up the sky with flames.";
   } else
   if (mp >= 751) {
     mine = "You shoot a ball of fire into the sky.";
     later = "Your ball shoots through the clouds.";
     ours = "A ball of fire shoots through the clouds.";
   } else {
     mine = "You throw a ball of fire into the air.";
     later = "Your ball of fire sputters and goes out.";
     ours = "A ball of fire flys into the air, sputters and goes out.";
   }
   message("info", "%^YELLOW%^"+mine, this_player());
   call_out("next_step", 1, ours, later, this_player());
   this_player()->set_mp(0);
   return 1;
}
Example #13
0
int cmd_akkarsa(string str) {
  object tp=this_player();

  int wis, summ, faith;
  int cost, len;
  int bad=0;
  float amt;
  
  if (!spell()) return 0;

  if (tp->query_disable()) return 1;

  if (!ok_cast(tp)) return 0;
  
  wis=tp->query_stats("wisdom");
  summ=tp->query_skill("summoning");
  faith=tp->query_skill("faith");
  
  amt=0.5+to_float((summ-210)/600);
  if (amt > 0.7) amt=0.7;
  len=summ/22+faith/26+wis*3/2;
  len=len*3/5;
  cost=len*4+50;
  
  if (tp->query_mp() < cost)
    FAIL("Too low on magic.\n");

  tp->set_disable(1);
  tp->add_mp(-cost);

  message("magic",COL+"You chant the word %^BOLD%^%^RED%^akkarsa"+RES+COL+".",tp);
  message("magic",COL+tp->query_cap_name()+" chants something."+RES,environment(tp),tp);
  
  if (tp->query_alignment() > -800) {
    message("magic","A horrible feeling washes over you.",tp);
    bad=1;
  }

  call_out("summon",2,({tp,amt,len,bad}));
Example #14
0
int cmd_vaporform(string str) {
  object tp = this_player();
  object env = environment(tp);
  object ob;

  if (!spell()) return 0;

  if (!can_cast(tp)) return 0;

  message("magic", COL+"Your body "+
    COL2+"f"+COL+"o"+COL2+"r"+COL+"m"+COL2+"s"+COL+" into "+
    COL2+"v"+COL+"a"+COL2+"p"+COL+"o"+COL2+"r"+COL+".", tp);

  message("magic", COL+tp->query_cap_name()+"'s body "+
    COL2+"f"+COL+"o"+COL2+"r"+COL+"m"+COL2+"s"+COL+" into "+
    COL2+"v"+COL+"a"+COL2+"p"+COL+"o"+COL2+"r"+COL+".", env, tp);

  tp->add_mp(-(60+random(25)));
  tp->set(VAPOR_PROP, 1);
  tp->set_property("passive", 1);
  tp->set_disquised_short("A cloud of vapor");
  if (ob = new(CMD_OB)) {
    ob->set_id( ({ VAPOR_CMD_ID }) );
Example #15
0
File: _mist.c Project: ehershey/pd
int cmd_mist(string str) {
  if (!spell())
    return notify_fail("What?\n");

  if (this_player()->query_disable())
    return notify_fail("You are busy.\n");

  if (this_player()->query_mp() < 50)
    return notify_fail("Your magic powers are exhausted.\n");

  if (environment(this_player())->query_property("no magic"))
    return notify_fail("A mysterious force prevents you from casting this spell.\n");

  this_player()->add_mp(-30 - random(50));
  write("A steamy mist forms around you...");
  message("info", "A mist slowly starts to form around "+this_player()->query_cap_name()+"!",
   environment(this_player()), this_player());
  this_player()->set_magic_round();
  this_player()->set_disable();

  call_out("cast_mist", 1, environment(this_player()), all_inventory(environment(this_player())));

  return 1;
}
Example #16
0
int cmd_inf(string str) {
  object tp=this_player();
  object env;
  object *tgts;
  string party;

  if (!spell()) return 0;

  if (!can_cast(tp)) return 0;

  env = environment(tp);
  party = tp->query_party();
  
  tgts = filter(all_inventory(env),
    function (object t, string p) {
      if (t->is_living()) {
        if (sizeof(p) && userp(t) && t->query_party() == p)
          return 0;
        else
          return 1;
      }
      else
        return 0;
    }, party);
Example #17
0
int cmd_replace(string str) {
    string who, limb;
    string *missing;
    string *limbs;
    int healing;
    int cost;
    object tp, ob;

    if (!spell())
    {
        write("What?\n");
        return 1;
    }

    tp = this_player();

    if( tp->query_ghost() )
        return notify_fail("You cannot do that in your immaterial state.\n");
    
    if( !str )
        return notify_fail("Replace what?\n");
    
    if( sscanf(str, "%s %s", who, limb) != 2 )
        return notify_fail("Correct syntax: <replace [player] [limb]>\n");
    
    ob = present(who, environment(tp));
    
    if( !ob )
        return notify_fail(capitalize(who) + " is not here.\n");
    
    if( ob->query_ghost() )
        return notify_fail("You cannot help the dead in that way.\n");
    
    if( !living(ob) )
        return notify_fail(ob->query_cap_name()+" is not a living thing!\n");
    
    limbs = (string *)ob->query_limbs();
    missing = (string *)ob->query_severed_limbs();
    
    if( !missing )
    {
        if( ob == tp )
            return notify_fail("You are not missing any limbs!\n");
        else
            return notify_fail(ob->query_cap_name()+" is not missing any limbs.\n");
    }
    
    if( member_array(limb, missing) == -1 || member_array(limb, limbs) != -1)
    {
        if( tp == ob )
            return notify_fail("You are not missing that limb!\n");
        else
            return notify_fail(ob->query_cap_name()+" is not missing that limb!\n");
    }

    this_player()->set_magic_round();
    healing = (int)tp->query_skill("healing")/2;
    healing += tp->query_skill("faith")/3;
    healing += tp->query_skill("belief")/3;
    healing -= random(76);
    
    if( tp == ob )
        cost = 175 + random(76);
    else
        cost = 250 + random(51);
    
    if( (int)tp->query_mp() < cost )
        return notify_fail("Too low on magic power.\n");
    
    tp->add_mp(-cost);
    
    if( healing < 1 )
    {
        message("info", "Your concentration is simply too weak.", tp);
        message("info", tp->query_cap_name() + " loses " +
                tp->query_possessive() + " concentration while in " +
                "prayer.", environment(tp), tp);
        tp->add_skill_points("healing", 10);
        return 1;
    }

    if( !add_limb(ob, limb) )
         return 0;

    if( tp == ob )
    {
        message("info", "Your " + limb + " regenerates through prayer!", tp);
        message("info", tp->query_cap_name() + "'s " + limb + " regenerates " +
                "through prayer!", environment(tp), tp);
        tp->add_skill_points("healing", to_int((healing / 3) + random(healing * 2 / 3)));
        tp->add_exp(to_int((healing / 3) + random(healing * 2 / 3)));
    }
    else
    {
        message("info", "You regenerate " + ob->query_cap_name() + "'s " +
                limb + " through prayer!", tp);
        message("info", tp->query_cap_name() + " regenerates your " + limb +
                " through prayer!", ob);
        message("info", tp->query_cap_name() + " says a prayer that " +
                "regenerates " + ob->query_cap_name() + "'s " + limb + ".",
                environment(tp), ({ tp, ob }) );
        tp->add_skill_points("healing", to_int((healing * 2 / 3) + random(healing / 3)));
        tp->add_exp(to_int((healing * 2 / 3) + random(healing / 3)));
        tp->add_alignment(to_int((healing * 2 / 3) + random(healing / 3)));
    }
Example #18
0
int cmd_replacin(string str) {
    string who, limb;
    string *missing;
    string *limbs;
    int healing;
    int cost;
    object tp, ob;
    tp = this_player();

    if(!spell())
      return notify_fail("What?\n");

    if(this_player()->query_ghost())
      return notify_fail("You cannot do that in your immaterial state.\n");

    if(!str)
      return notify_fail("Replace what?\n");

    if(!alignment_ok(tp))
      return notify_fail("You have betrayed the source of your powers!\n");

    if(sscanf(str, "%s %s", who, limb) != 2)
      return notify_fail("Correct syntax: <replace [player] [limb]>\n");

    if(who == "me") ob = tp;
    else ob = find_player(who);

    if(!ob || environment(ob) != environment(tp))
      return notify_fail(capitalize(who) + " is not here.\n");

    if(ob->query_ghost())
      return notify_fail("You cannot help the dead in that way.\n");

    if(!living(ob))
      return notify_fail(ob->query_cap_name()+" is not a living thing!\n");

    limbs = ob->query_limbs();
    missing = ob->query_severed_limbs();

    if(!ob->query_is_limb(limb)) {
      write("That is not a valid limb!");
      return 1;
      }

    if(!missing) {
      if(ob==tp) notify_fail("You are not missing any limbs!\n");
      else notify_fail(ob->query_cap_name()+" is not missing any limbs.\n");
      return 1;
      }

    if(member_array(limb, limbs) != -1) {
        if(tp==ob) notify_fail("You are not missing that limb!\n");
        else notify_fail(ob->query_cap_name()+" is not missing that limb.\n");
        return 1;
    }

    if(member_array(limb, missing) == -1) {
      if(tp==ob) notify_fail("You are not missing your that limb!\n");
      else notify_fail(ob->query_cap_name()+" is not missing that limb!\n");
      return 1;
      }

    tp->set_magic_round();
    healing = tp->query_skill("healing");
    healing -= random(101);
    if(tp==ob) cost = 120;
    else cost = random(100) + 20;

    if(tp->query_mp() < cost)
      return notify_fail("Not enough magical power.\n");

    tp->add_mp(-cost);

    if(healing < 1) {
      write("Your concentration is simply too weak.\n");
      say(tp->query_cap_name()+" loses "+tp->query_possessive()+" concentration while in prayer.\n", tp);
      tp->add_skill_points("healing", 10);
      return 1;
      }

    add_limb(ob, limb, tp, healing);
    return 1;
}
Example #19
0
File: _lore.c Project: ehershey/pd
int cmd_lore(string str) {
    object ob;
    object *inv;
    int i, skip, which, conjure;
    string what, clas;
    mixed *arr;

   if (!spell()) {
      write("What?\n");
      return 1;
   }
    if(!str) {
        notify_fail("Gather lore about what?\n");
        return 0;
    }
    clas = (string)this_player()->query_class();
    if(clas != "mage") {
        notify_fail("Your mind boggles in confusion.\n");
        return 0;
    }
    ob = present(str, this_player());
    if(!ob) {
        inv = all_inventory(this_player());
        if(sscanf(str, "%s %d", what, which) != 2) {
            notify_fail("You don't have that!\n");
            return 0;
        }
        for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
            if(inv[i]->id(what)) {
                skip ++;
                if(skip == which) ob = inv[i];
            }
        }
        if(!ob) {
            notify_fail("You don't have that!\n");
            return 0;
        }
    }
    conjure = (int)this_player()->query_skill("conjuring");
    if((int)this_player()->query_mp() < 13) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    say(this_player()->query_cap_name()+" mutters quietly as "+
        this_player()->query_subjective()+" focuses on the "+
        (string)ob->query_name()+".", this_player());
  this_player()->set_magic_round();
  if(conjure < random(101)) {
  this_player()->add_mp(-13);
  this_player()->add_skill_points("conjuring", random(13));
        write("You fail to discern anything special about it.");
        return 1;
    }
    else {
        this_player()->add_mp(-13);
        this_player()->add_skill_points("conjuring", 13);
        arr = (string *)ob->query_property("magic item");
        if(!arr) write("You fail to discern anything special about it.");
        else if(arr == ({})) write("You fail to discern anything "
          "special about it.");
        else write("You discern a magical force eminating from it...\n"
Example #20
0
int cmd_cure(string str) {
    string whom, limb, clas;
    int amount, cost, healing, i;
    object tp, ob;
    string * limbs;
   if (!spell()) {
      notify_fail("What?\n");
      return 0;
   }
    if(!str) {
        notify_fail("Cure whom?\n");
        return 0;
    }
    tp = this_player();
    if(tp->query_disable()) {
        notify_fail("You are in the middle of something else.\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    healing = (int)tp->query_skill("healing");
    clas = (string)tp->query_subclass();
    if(str == "me" || str == "myself") ob = tp;
    else ob = present(str, environment(tp));
    if(!ob) {
        if(sscanf(str, "%s %s", whom, limb) != 2) {
            notify_fail("Correct syntax: <cure [who] [(limb)]\n");
            return 0;
        }
        if(whom == "me" || whom == "myself") ob = tp;
        else ob = present(whom, environment(tp));
    }
    if(!ob) {
        notify_fail("Cure whom?\n");
        return 0;
    }
    if(!limb) cost = healing*2/3;
    else if(limb == "all") cost = healing;
    else if(member_array(limb, (string *)ob->query_limbs()) == -1) {
        notify_fail("That limb is missing!\n");
        return 0;
    }
    else cost = healing/3;
    if(ob != tp) cost = random(cost);
    if((int)tp->query_mp() < cost) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    tp->add_mp(-cost);
    amount = (healing*((int)ob->query_level()))/10;
    if(amount > 400) {
       log_file("hmmm", this_player()->query_name()+" healing "+ob->query_short()+" "+amount+"\n");
       amount = 400;
    }
    if(clas == "paladin"){
      amount = amount/2;
    }
    this_player()->set_magic_round(2);
    if(tp == ob) tp->add_skill_points("healing", amount/6);
    else {
        tp->add_skill_points("healing", amount/2);
        tp->add_alignment("healing", amount/5);
    }
    if(!limb) {
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    else if(limb == "all") {
        limbs = (string *)ob->query_limbs();
        for(i=0; i<sizeof(limbs); i++) {
          ob->heal_limb(limbs[i], (amount/2));
        }
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    else {
        ob->add_hp(amount/4);
      if (tp->query_hp() < 1) {
        ob->set_hp(1);
        send_messages(tp, ob, clas, 0);}
      else{   
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);}
    }
    tp->set_disable();
    return 1;
}
Example #21
0
bool CheckSpecifier::visit(SimpleSpecifierAST *ast)
{
    switch (tokenKind(ast->specifier_token)) {
        case T_CONST:
            if (_fullySpecifiedType.isConst())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setConst(true);
            break;

        case T_VOLATILE:
            if (_fullySpecifiedType.isVolatile())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setVolatile(true);
            break;

        case T_FRIEND:
            if (_fullySpecifiedType.isFriend())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setFriend(true);
            break;

        case T_REGISTER:
            if (_fullySpecifiedType.isRegister())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setRegister(true);
            break;

        case T_STATIC:
            if (_fullySpecifiedType.isStatic())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setStatic(true);
            break;

        case T_EXTERN:
            if (_fullySpecifiedType.isExtern())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setExtern(true);
            break;

        case T_MUTABLE:
            if (_fullySpecifiedType.isMutable())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setMutable(true);
            break;

        case T_TYPEDEF:
            if (_fullySpecifiedType.isTypedef())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setTypedef(true);
            break;

        case T_INLINE:
            if (_fullySpecifiedType.isInline())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setInline(true);
            break;

        case T_VIRTUAL:
            if (_fullySpecifiedType.isVirtual())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setVirtual(true);
            break;

        case T_EXPLICIT:
            if (_fullySpecifiedType.isExplicit())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setExplicit(true);
            break;

        case T_SIGNED:
            if (_fullySpecifiedType.isSigned())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setSigned(true);
            break;

        case T_UNSIGNED:
            if (_fullySpecifiedType.isUnsigned())
                translationUnit()->error(ast->specifier_token,
                                         "duplicate `%s'", spell(ast->specifier_token));
            _fullySpecifiedType.setUnsigned(true);
            break;

        case T_CHAR:
            if (_fullySpecifiedType)
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            _fullySpecifiedType.setType(control()->integerType(IntegerType::Char));
            break;

        case T_WCHAR_T:
            if (_fullySpecifiedType)
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            _fullySpecifiedType.setType(control()->integerType(IntegerType::WideChar));
            break;

        case T_BOOL:
            if (_fullySpecifiedType)
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            _fullySpecifiedType.setType(control()->integerType(IntegerType::Bool));
            break;

        case T_SHORT:
            if (_fullySpecifiedType) {
                IntegerType *intType = control()->integerType(IntegerType::Int);
                if (_fullySpecifiedType.type() != intType)
                    translationUnit()->error(ast->specifier_token,
                                             "duplicate data type in declaration");
            }
            _fullySpecifiedType.setType(control()->integerType(IntegerType::Short));
            break;

        case T_INT:
            if (_fullySpecifiedType) {
                Type *tp = _fullySpecifiedType.type();
                IntegerType *shortType = control()->integerType(IntegerType::Short);
                IntegerType *longType = control()->integerType(IntegerType::Long);
                IntegerType *longLongType = control()->integerType(IntegerType::LongLong);
                if (tp == shortType || tp == longType || tp == longLongType)
                    break;
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            }
            _fullySpecifiedType.setType(control()->integerType(IntegerType::Int));
            break;

        case T_LONG:
            if (_fullySpecifiedType) {
                Type *tp = _fullySpecifiedType.type();
                IntegerType *intType = control()->integerType(IntegerType::Int);
                IntegerType *longType = control()->integerType(IntegerType::Long);
                FloatType *doubleType = control()->floatType(FloatType::Double);
                if (tp == longType) {
                    _fullySpecifiedType.setType(control()->integerType(IntegerType::LongLong));
                    break;
                } else if (tp == doubleType) {
                    _fullySpecifiedType.setType(control()->floatType(FloatType::LongDouble));
                    break;
                } else if (tp != intType) {
                    translationUnit()->error(ast->specifier_token,
                                             "duplicate data type in declaration");
                }
            }
            _fullySpecifiedType.setType(control()->integerType(IntegerType::Long));
            break;

        case T_FLOAT:
            if (_fullySpecifiedType)
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            _fullySpecifiedType.setType(control()->floatType(FloatType::Float));
            break;

        case T_DOUBLE:
            if (_fullySpecifiedType) {
                IntegerType *longType = control()->integerType(IntegerType::Long);
                if (_fullySpecifiedType.type() == longType) {
                    _fullySpecifiedType.setType(control()->floatType(FloatType::LongDouble));
                    break;
                }
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            }
            _fullySpecifiedType.setType(control()->floatType(FloatType::Double));
            break;

        case T_VOID:
            if (_fullySpecifiedType)
                translationUnit()->error(ast->specifier_token,
                                         "duplicate data type in declaration");
            _fullySpecifiedType.setType(control()->voidType());
            break;

        default:
            break;
    } // switch
    accept(ast->next);
    return false;
}
Example #22
0
int cmd_heal(string str) {
  string whom, limb, clas;
  int amount, cost, healing, i, wisdom;
  object tp, ob;
  string * limbs;
  if (!spell()) {
    return 0;
  }
  if(!str) {
    notify_fail("Heal whom?\n");
    return 0;
  }
  tp = this_player();
  if(tp->query_disable()) {
    notify_fail("You are in the middle of something else.\n");
    return 0;
  }
  if(!alignment_ok(this_player())) {
    notify_fail("You have betrayed the source of your powers.\n");
    return 0;
  }
  if(this_player()->query_ghost())
    return notify_fail("You cannot speak without a body.\n");
  healing = (int)tp->query_skill("healing")/2;
  healing += (int)tp->query_level()/3;
  healing += (int)tp->query_skill("faith")/4;
  healing += tp->query_skill("belief")/4;

  clas = (string)tp->query_subclass();
  if(str == "me" || str == "myself") ob = tp;
  else ob = present(str, environment(tp));
  if(!ob) {
    if(sscanf(str, "%s %s", whom, limb) != 2) {
      notify_fail("Heal whom?\n");
      return 0;
    }
    if(whom == "me" || whom == "myself") ob = tp;
    else ob = present(whom, environment(tp));
  }
  if(!ob) {
    notify_fail("Heal whom?\n");
    return 0;
  }
  if(!limb) cost = healing/2;
  else if(limb == "all") cost = healing*3/4;
  else if(member_array(limb, (string *)ob->query_limbs()) == -1) {
    notify_fail("That limb is missing!\n");
    return 0;
  }
  else cost = healing/3;
  if(ob != tp) cost = random(cost);
  if((int)tp->query_mp() < cost) {
    notify_fail("Too low on magic power.\n");
    return 0;
  }
  tp->add_mp(-cost);
  amount = (healing);
  if(amount > 800) {
    log_file("hmmm", this_player()->query_name()+" healing "+ob->query_short()+" "+amount+"\n");
    amount = 800;
  }
  this_player()->set_magic_round(2);
  if(tp == ob) tp->add_skill_points("healing", amount/3);
  else {
    tp->add_skill_points("healing", amount/2);
    tp->add_alignment(amount/5);
    tp->add_exp(amount/4);
  }
  if(!limb) {
    ob->add_hp(amount);
  }
  else if(limb == "all") {
    limbs = (string *)ob->query_limbs();
    for(i=0; i<sizeof(limbs); i++) {
      ob->heal_limb(limbs[i], (amount/2));
    }
    ob->add_hp(amount/2);
  }
  else {
    ob->heal_limb(limb, amount);  
    ob->add_hp(amount/3);
  }
  send_messages(tp, ob, clas, limb);
  return 1;
}
Example #23
0
File: _heal.c Project: ehershey/pd
int cmd_heal(string str) {
    string whom, limb, clas;
    int amount, cost, healing, i, wisdom;
    object tp, ob;
    string * limbs;

   if (!spell()) {
      write("What?\n");
      return 1;
   }
    if(!str) {
        notify_fail("Heal whom?\n");
        return 0;
    }
    tp = this_player();
    if(tp->query_casting()) {
        notify_fail("You are in the middle of another spell!\n");
        return 0;
    }
    if(!alignment_ok(this_player())) {
        notify_fail("You have betrayed the source of your powers.\n");
        return 0;
    }
    healing = (int)tp->query_skill("healing");
    wisdom = (int)tp->query_stats("wisdom");
    clas = (string)tp->query_subclass();
    if(str == "me" || str == "myself") ob = tp;
    else ob = present(str, environment(tp));
    if(!ob) {
        if(sscanf(str, "%s %s", whom, limb) != 2) {
            notify_fail("Correct syntax: <heal [who] [(limb)]\n");
            return 0;
        }
        if(whom == "me" || whom == "myself") ob = tp;
        else ob = present(whom, environment(tp));
    }
    if(!ob) {
        notify_fail("Heal whom?\n");
        return 0;
    }
    if(!limb) cost = 22;
    else if(limb == "all") cost = 44;
    else if(member_array(limb, (string *)tp->query_limbs()) == -1) {
        notify_fail("You do not have a "+limb+".\n");
        return 0;
    }
    else cost = 14;
    if(ob != tp) cost = random(cost);
    if((int)tp->query_mp() < cost) {
        notify_fail("Too low on magic power.\n");
        tp->add_mp(-cost);
        return 0;
    }
    this_player()->set_magic_round(1);
    tp->add_mp(-cost);
    if(healing < 5) amount = 0;
    else amount = random(wisdom + (healing/10));
    if(!amount) {
        write("You do not have the skill to do that.");
        return 1;
    }
    if(tp == ob) tp->add_skill_points("healing", amount);
    else {
        tp->add_skill_points("healing", amount * 2);
        tp->add_alignment(amount);
        tp->add_exp(random((amount/2)+2));
    }
    if(!limb) {
        ob->add_hp(amount);
        send_messages(tp, ob, clas, 0);
    }
    else if(limb == "all") {
        limbs = (string *)ob->query_limbs();
        for(i=0; i<sizeof(limbs); i++) {
            ob->heal_limb(limbs[i], (amount / 2));
        }
        ob->add_hp(amount / 2);
        send_messages(tp, ob, clas, limb);
    }
    else {
        ob->heal_limb(limb, amount);
        send_messages(tp, ob, clas, limb);
    }
    return 1;
}
Example #24
0
static void OutputChecks(short sfile)
{
	short ef=0,count=0;
	int checkno=0,vcheckno=0,last_checkno=0,last_vcheckno=0,fyear=0,trnnum=0;
	RDA_PFILE *fp=NULL;
	double total_amt=0.0,amt=0.0;
	char *emp_name=NULL,*emp_add1=NULL,*emp_add2=NULL,*emp_add3=NULL;
	char *spelled_amt=NULL,*checkdate=NULL;
	int x=0;
	short prtsig=1;
	char *desc=NULL;
	char *ddsid=NULL;
	char *tempstr=NULL;
	char dcd=FALSE;

	if(isEMPTY(output_device))
	{
		prterr("Error:  An appropriate output device must be selected to print checks.");
		return;
	}
	fp=RDA_popen(output_device,"w");
	if(fp==NULL)
	{
		prterr("Error:  Couldn't open output device [%s].",output_device);
	}
	SelectPrintTypeByName(output_device,"PCL JOB HEADER",fp);
	if(signature_type==5)
	{
		SelectPrintTypeByName(output_device,"LOAD PAYROLL SIGNATURE",fp);
	}
	SelectPrintTypeByName(output_device,"SIMPLEX",fp);
	if(top_feeder==TRUE)
	{
		RDA_fprintf(fp,"\f");
	}
	ZERNRD(sfile);
	ef=FRSNRD(sfile,1);
	FINDFLDGETINT(sfile,"CHECK NUMBER",&checkno);
	FINDFLDGETINT(sfile,"VIRTUAL CHECK NUMBER",&vcheckno);
	last_checkno=checkno;
	last_vcheckno=vcheckno;
	while(!ef)
	{
		FINDFLDGETINT(sfile,"CHECK NUMBER",&checkno);
		FINDFLDGETINT(sfile,"VIRTUAL CHECK NUMBER",&vcheckno);
		if(checkno!=last_checkno || vcheckno!=last_vcheckno)
		{
			while(count<BODY_COUNT+7)
			{
				RDA_fprintf(fp,"\r\n");	
				++count;
			}
			if(RDAstrlen(emp_name)>40) emp_name[40]=0;
			if(checkno==last_checkno)
			{
				RDA_fprintf(fp,"%10s %8d %-30.30s Sub-Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
			}
			else
			{
				RDA_fprintf(fp,"%10s %8d %-30.30s     Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
			}
			++count;
			RDA_fprintf(fp,"\r\n");	
			RepeatStub(sfile,last_checkno,last_vcheckno,fp);
			if(checkno==last_checkno)
			{
				RDA_fprintf(fp,"%10s %8d %-30.30s Sub-Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
			}
			else
			{
				RDA_fprintf(fp,"%10s %8d %-30.30s     Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
			}
			++count;
			RDA_fprintf(fp,"\r\n");	
	/* negotiable check */
			/*RDA_fprintf(fp,"\r\n");*/
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"\r\n");
			if(top_feeder==FALSE)
			{
				RDA_fprintf(fp,"\r\n");
				RDA_fprintf(fp,"\r\n");
			}
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"\r\n");
			if(!use_high_amount || high_amount!=1)
			{
				RDA_fprintf(fp,"\r\n");
			}
			if(high_amount==2)
			{
				RDA_fprintf(fp,"\r\n");
			}
			if(checkno!=last_checkno)
			{
				spelled_amt=spell(total_amt);
				RDA_fprintf(fp,"  %s\r\n",spelled_amt);
				if(spelled_amt!=NULL) Rfree(spelled_amt);
				if(high_amount!=2)
				{
					RDA_fprintf(fp,"\r\n");
				}
				if(!use_high_amount || high_amount!=1)
				{
					RDA_fprintf(fp,"\r\n");
				}
				tempstr=famtpad(total_amt,14,'*');
				RDA_fprintf(fp,"%44s %-10s%10d %-14s\r\n",
					"",(checkdate!=NULL?checkdate:""),last_vcheckno,
					(tempstr!=NULL?tempstr:""));
				if(tempstr!=NULL) Rfree(tempstr);
				RDA_fprintf(fp,"\r\n");
				prtsig=1;
			} else {
				RDA_fprintf(fp,"  *** V O I D **** V O I D **** V O I D **** \r\n");
				if(high_amount!=2)
				{
					RDA_fprintf(fp,"\r\n");
				}
				if(!use_high_amount || high_amount!=1)
				{
					RDA_fprintf(fp,"\r\n");
				}
				tempstr=famtpad(0,14,'*');
				RDA_fprintf(fp,"%44s %-10s%10d %-14s\r\n",
					"",(checkdate!=NULL?checkdate:""),last_vcheckno,
					(tempstr!=NULL?tempstr:""));
				if(tempstr!=NULL) Rfree(tempstr);
				prtsig=0;
				RDA_fprintf(fp,"\r\n");
			}
			if(check_address_offset<0)
			{
				RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_name!=NULL ? emp_name:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add1!=NULL ? emp_add1:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add2!=NULL ? emp_add2:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add3!=NULL ? emp_add3:""));
			} else {
				RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_name!=NULL ? emp_name:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add1!=NULL ? emp_add1:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add2!=NULL ? emp_add2:""));
				RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add3!=NULL ? emp_add3:""));
			}
			if(signature_type==5)
			{
				SelectPrintTypeByName(output_device,"PUSH CURSOR",fp);
				if(prtsig) { SelectPrintTypeByName(output_device,"PAYROLL SIGNATURE",fp); }
				SelectPrintTypeByName(output_device,"POP CURSOR",fp);
			}
			RDA_fprintf(fp,"\f");
			count=0;	
			if(checkno!=last_checkno)
			{
				total_amt=0;
			}
			last_checkno=checkno;
			last_vcheckno=vcheckno;
		}
		FINDFLDGETINT(sfile,"FISCAL YEAR",&fyear);
		FINDFLDGETSTRING(sfile,"DEDUCTION DESCRIPTION IDENTIFICATION",&ddsid);
		FINDFLDGETINT(sfile,"TRANSACTION NUMBER",&trnnum);
		FINDFLDGETSTRING(sfile,"CHECK DATE",&checkdate);
		FINDFLDGETSTRING(sfile,"NAME",&emp_name);
		FINDFLDGETDOUBLE(sfile,"AMOUNT",&amt);
		FINDFLDGETSTRING(sfile,"VENDOR NAME",&emp_name);
		if(RDAstrlen(emp_name)>40) emp_name[40]=0;
		FINDFLDGETSTRING(sfile,"DESCRIPTION",&desc);
		if(RDAstrlen(desc)>40) desc[40]=0;
		FINDFLDGETSTRING(sfile,"VENDOR ADDRESS 1",&emp_add1);
		FINDFLDGETSTRING(sfile,"VENDOR ADDRESS 2",&emp_add2);
		FINDFLDGETSTRING(sfile,"VENDOR ADDRESS 3",&emp_add3);
		if(use_check_offset && count==0)
		{
			for(x=0;x<check_offset;x++)
			{
				RDA_fprintf(fp,"\r\n");	
			}
		}
		if((count==0) && (dcd==FALSE))
		{
			RDA_fprintf(fp,"\r\n");
			RDA_fprintf(fp,"     SEE ATTACHED LIST FOR CHECK DETAIL\r\n");
			count+=2;
		}
	/* print 1st detail stub */
		if(dcd==TRUE)
		{
			RDA_fprintf(fp,"%5d %-30s %-24.24s $%12.2f\r\n",
                            	fyear, ddsid, desc, amt/100);
			if(ddsid!=NULL) Rfree(ddsid);
			if(desc!=NULL) Rfree(desc);
			++count;
		}
		total_amt+=amt;
		ef=NXTNRD(sfile,1);
	}
	/*while(count<BODY_COUNT+8)*/
	while(count<BODY_COUNT+7)
	{
		RDA_fprintf(fp,"\r\n");	
		++count;
	}
	RDA_fprintf(fp,"%10s %8d %-30.30s     Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
	++count;
	RDA_fprintf(fp,"\r\n");	
	/* repeat stub and print negotiable */
	RepeatStub(sfile,last_checkno,last_vcheckno,fp);
	RDA_fprintf(fp,"%10s %8d %-30.30s     Total: $%12.2f\r\n",(checkdate!=NULL?checkdate:""),last_checkno,(emp_name!=NULL ? emp_name:""),total_amt/100);
	++count;
	RDA_fprintf(fp,"\r\n");	
	RDA_fprintf(fp,"\r\n");
	RDA_fprintf(fp,"\r\n");
	if(top_feeder==FALSE)
	{
		RDA_fprintf(fp,"\r\n");
		RDA_fprintf(fp,"\r\n");
	}
	RDA_fprintf(fp,"\r\n");
	RDA_fprintf(fp,"\r\n");
	RDA_fprintf(fp,"\r\n");
	RDA_fprintf(fp,"\r\n");
	RDA_fprintf(fp,"\r\n");
	if(!use_high_amount || high_amount!=1)
	{
		RDA_fprintf(fp,"\r\n");
	}
	if(high_amount==2)
	{
		RDA_fprintf(fp,"\r\n");
	}
	spelled_amt=spell(total_amt);
	RDA_fprintf(fp,"  %s\r\n",spelled_amt);
	if(spelled_amt!=NULL) Rfree(spelled_amt);
	if(high_amount!=2)
	{
		RDA_fprintf(fp,"\r\n");
	}
	if(!use_high_amount || high_amount!=1)
	{
		RDA_fprintf(fp,"\r\n");
	}
	tempstr=famtpad(total_amt,14,'*');
	RDA_fprintf(fp,"%44s %-10s%10d %-14s\r\n",
		"",(checkdate!=NULL?checkdate:""),last_vcheckno,
		(tempstr!=NULL?tempstr:""));
	if(tempstr!=NULL) Rfree(tempstr);
	RDA_fprintf(fp,"\r\n");
	if(check_address_offset<0)
	{
		RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_name!=NULL ? emp_name:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add1!=NULL ? emp_add1:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add2!=NULL ? emp_add2:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",8,"",(emp_add3!=NULL ? emp_add3:""));
	} else {
		RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_name!=NULL ? emp_name:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add1!=NULL ? emp_add1:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add2!=NULL ? emp_add2:""));
		RDA_fprintf(fp,"%*s%-40s\r\n",(check_address_offset+8),"",(emp_add3!=NULL ? emp_add3:""));
	}
	if(signature_type==5)
	{
		SelectPrintTypeByName(output_device,"PUSH CURSOR",fp);
		if(prtsig) { SelectPrintTypeByName(output_device,"PAYROLL SIGNATURE",fp); }
		SelectPrintTypeByName(output_device,"POP CURSOR",fp);
	}
	RDA_fprintf(fp,"\f");
	count=0;	
	if(checkno!=last_checkno)
	{
		total_amt=0;
	}
	last_checkno=checkno;
	last_vcheckno=vcheckno;
	if(signature_type==5)
	{
		SelectPrintTypeByName(output_device,"DELETE_SOFTFONT_200",fp);
		SelectPrintTypeByName(output_device,"DELETE_SOFTFONT_201",fp);
	}
	SelectPrintTypeByName(output_device,"PCL JOB FOOTER",fp);
	RDA_pclose(fp);
	if(checkdate!=NULL) Rfree(checkdate);
}
Example #25
0
File: _peace.c Project: ehershey/pd
int cmd_peace(string str) {
    object *inv;
    int faith, belief, i, def;
    if (!spell() && !wizardp(this_player())) {
        write("What?\n");
        return 1;
    }
    if((int)this_player()->query_mp() < 10) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    if (this_player()->query_disable() && !wizardp(this_player()))
        return notify_fail("You are busy.\n");
    if(!alignment_ok(this_player()) && !wizardp(this_player())) {
        notify_fail("You have betrayed the source of your power.\n");
        return 0;
    }
    faith = (int)this_player()->query_skill("faith");
    belief = (int)this_player()->query_skill("belief");
    this_player()->add_mp(-random(51));
    if (!wizardp(this_player())) {
        if (this_player()->query_subclass() == "cleric") {
            if (belief < 10) def = 2; else
            if (belief < 55) def = 3; else
            if (belief < 110) def = 4; else
            if (belief < 165) def = 5; else
            if (belief < 220) def = 6; else
            if (belief >= 220) def = 7;
            this_player()->add_mp(belief/2-random(belief/4));
            if(random(def)<2) {
                notify_fail("Your belief does not bring peace, this time.\n");
                return 0;
            }
        }
        else {
            if (faith < 10) def = 2; else
            if (faith < 55) def = 3; else
            if (faith < 110) def = 4; else
            if (faith < 165) def = 5; else
            if (faith < 220) def = 6; else
            if (faith >= 220) def = 7;
            this_player()->add_mp(faith/2-random(faith/4));
            if(random(def)<2) {
                notify_fail("Your faith does not bring peace, this time.\n");
                return 0;
            }
        }
    }
    write("You bring peace to the area.\n");
    say(this_player()->query_cap_name()+" raises "+this_player()->query_possessive()+" hands to the sky and brings peace to the area.\n", this_player());
    if ((this_player()->query_class("cleric"))) {
        this_player()->add_skill_points("belief", 1);
    }
    if ((this_player()->query_class("monk"))) {
        this_player()->add_skill_points("faith", 1);
    }
    this_player()->add_alignment(5);
    this_player()->set_magic_round(2);
    this_player()->set_disable(2);
    inv = all_inventory(environment(this_player()));
    for(i=0; i<sizeof(inv); i++) {
        if(!living(inv[i])) continue;
        inv[i]->cease_all_attacks();
    }
    return 1;
}
Example #26
0
int cmd_psiblast(string str) {
   object tp, ob;
   int attack, intelligence, skip, which, i;
   string what;
   object *inv;

   if(!spell()) {
     write("Ha ha! You are too stupid to cast this.");
     return 1;
   }

   this_player()->set_magic_round();
   tp = this_player();
   if(tp->query_ghost()) {
     notify_fail("You have no brain with which to think.\n");
     return 0;
   }

   if((string)tp->query_class() == "child") {
     notify_fail("You do not have the mental discipline to do this.\n");
     return 0;
   }

   if(tp->query_casting()) return 1;
   if((int)tp->query_mp() < 15) {
     notify_fail("You are not focused enough.\n");
     return 0;
   }

   if(!str) {
     ob = (object)tp->query_current_attacker();
     if(!ob) {
       notify_fail("Psiblast what?\n");
       return 0;
     }
   }

   else {
     ob = present(str, environment(tp));
     if(!ob) {
       sscanf(str, "%s %d", what, which);
       inv = all_inventory(environment(tp));
       for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
          if(inv[i]->id(what)) {
             skip++;
             if(skip == which) ob = inv[i];
          }
       }

       if(!ob) {
          notify_fail("No "+str" here...\n");
          return 0;
       }
    }
   }

   if(!living(ob)) {
     notify_fail(ob->query_cap_name()+" has no mind.\n");
     return 0;
   }

   if(ob == tp) {
     notify_fail("How do you propose to do that?\n");
     return 0;
   }

   if(ob->is_player() && !interactive(ob)) {
     notify_fail("You cannot attack link-dead players.\n");
     return 0;
   }
   attack = (int)tp->query_skill("magic attack");
   intelligence = (int)tp->query_stats("intelligence");
   attack -= intelligence;
   if(attack < 1) attack = 1;
   if(!tp->kill_ob(ob, 0)) return 1;
   write("%^MAGENTA%^You fire a burst of psychic energy.%^RESET%^");
   tell_room(environment(tp), "%^MAGENTA%^"+tp->query_cap_name()+
       "fires a burst of psychic energy at "
       +(string)ob->query_cap_name()+".%^RESET%^",
       ({ ob, tp }) );
Example #27
0
int cmd_polymorph(string str) {
    object tp, ob;
    int i, which, skip, attack;
    object *inv;
    string what;

   if (!spell()) {
      return 0;
   }

    this_player()->set_magic_round();

    tp = this_player();

    if(tp->query_ghost()) {
        notify_fail("You emit a ghostly moan.\n");
        return 0;
    }
    
    if (tp->query_disable())
        return notify_fail("You are too busy to cast this spell.\n");
    
    if(environment(tp)->query_property("no magic")
       || environment(tp)->query_property("no attack")) {
        notify_fail("Something seems to be blocking your concentration.\n");
        return 0;
    }
    
    if(tp->query_casting()) return notify_fail("You are already casting a spell!");
    
    if((int)tp->query_mp() < 75) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    
    if(!str) {
        ob = (object)tp->query_current_attacker();
        if(!ob) {
            return notify_fail("What did you want to alter?\n");
        }
    }
    else {
        ob = present(str, environment(tp));
        if(!ob) {
            sscanf(str, "%s %d", what, which);
            inv = all_inventory(environment(tp));
            for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
                if(inv[i]->id(what)) {
                    skip++;
                    if(skip == which) ob = inv[i];
                }
            }
            if(!ob) {
                notify_fail("No "+str+" here!\n");
                return 0;
            }
        }
    }
    
    if(!living(ob)) {
        notify_fail(ob->query_cap_name()+" is not a living thing!\n");
        return 0;
    }
    
    if(ob==tp) {
        notify_fail("Your spell fails due to lack of intelligence.\n");
        return 0;
    }
    if(ob->is_player() && !interactive(ob)) {
        notify_fail("You cannot morph link-dead players.\n");
        return 0;
    }
    if(ob->query_property("no polymorph") || ob->query_property("no magic")) {
      notify_fail(sprintf("%s is immune to such magic.\n",
                  ob->query_cap_name()));
      return 0;
    }
    
    if(!ob->is_monster())
    {
        return notify_fail("Your spell bounces off of "+ob->query_cap_name()+"!\n");
    }
    if(ob->query_skill("magic defense") > tp->query_skill("conjuring"))
    {
        return notify_fail("Your spell bounces off of "+ob->query_cap_name()+"!\n");
    }
    if(3*(ob->query_stats("wisdom"))/2 > tp->query_stats("wisdom"))
    {
        return notify_fail("Your spell bounces off of "+ob->query_cap_name()+"!\n");
    }
    
   
    write("%^ORANGE%^You move your hands in an %^BOLD%^%^WHITE%^in%^RESET%^%^CYAN%^tr%^BOLD%^%^WHITE%^ic%^RESET%^%^CYAN%^ate%^RESET%^%^ORANGE%^ pattern, and suddenly a cloud of %^BOLD%^%^BLACK%^smoke%^RESET%^%^ORANGE%^ appears around "
        +ob->query_cap_name()+ " then fades away!");
    
    message("room","%^ORANGE%^" +tp->query_cap_name()+ 
        " moves " 
        +tp->query_possessive()+   
        " hands in an %^BOLD%^%^WHITE%^in%^RESET%^%^CYAN%^tr%^BOLD%^%^WHITE%^ic%^RESET%^%^CYAN%^ate%^RESET%^%^ORANGE%^ pattern, and suddenly a cloud of %^BOLD%^%^BLACK%^smoke%^RESET%^%^ORANGE%^ appears around "
        +ob->query_cap_name()+ " then fades away!"
        , environment(tp), ({tp,ob}));            
Example #28
0
int cmd_fireball(string str) {
    object tp, ob;
    int attack, wisdom, skip, which, i;
    string what, *strengths, *weaknesses;
    object *inv;
   if (!spell()) {
      notify_fail("What?\n");
      return 0;
   }
    this_player()->set_magic_round();
    tp = this_player();
    if(tp->query_ghost()) {
        notify_fail("Your voice is hollow.\n");
        return 0;
    }
    if((string)tp->query_class() != "mage") {
        write("You mumble in confusion.");
        say(tp->query_cap_name()+" mumbles in confusion.", tp);
        return 1;
    }
    if(environment(tp)->query_property("no magic")) {
        notify_fail("Something seems to be blocking your concentration.\n");
        return 0;
    }
    if (this_player()->query_disable())
       return notify_fail("You are busy.\n");
    if((int)tp->query_mp() < 20) {
        notify_fail("Too low on magic power.\n");
        return 0;
    }
    if(!str) {
        ob = (object)tp->query_current_attacker();
        if(!ob) {
            notify_fail("Fireball what?\n");
            return 0;
        }
    }
    else {
        ob = present(str, environment(this_player()));
        if(!ob) {
            sscanf(str, "%s %d", what, which);
            inv = all_inventory(environment(tp));
            for(i=0, skip = 0; i<sizeof(inv) && !ob; i++) {
                if(inv[i]->id(what)) {
                    skip++;
                    if(skip == which) ob = inv[i];
                }
            }
            if(!ob) {
                notify_fail("You do not see "+str+" here.\n");
                return 0;
            }
        }
    }
    if(!living(ob)) {
        notify_fail(ob->query_cap_name()+" is not a living thing!\n");
        return 0;
    }
    if(ob == tp) {
        notify_fail("Not a very bright thing to do.\n");
        return 0;
    }
    if(ob->is_player() && !interactive(ob)) {
        notify_fail("You cannot attack link-dead players.\n");
        return 0;
    }
    if(ob->query_property("no magic")) {
        notify_fail(sprintf("%s is immune to your magic.\n",
          ob->query_cap_name()));
        return 0;
    }
    if(!this_player()->kill_ob(ob)) {
        write(ob->query_cap_name()+" can't be attacked by you yet.");
       return 1;
    }
    attack = (int)tp->query_skill("magic attack")*2/3 + (int)tp->query_stats("wisdom");
    wisdom = (int)ob->query_stats("wisdom")/2 + (int)ob->query_skill("magic defense")/3;
    attack -= wisdom;
    weaknesses = (string *)ob->query_property("weakness");
    if (!pointerp(weaknesses))
        weaknesses = ({ });
Example #29
0
/* --------------------------------- main -------------------------------- */
int main(int argc, char **argv) {

    char               dictionary[12][SPELL_SIZE],
		       lookup[SPELL_SIZE],
		       target[SPELL_SIZE];

    int                i;

    /* Create a sorted dictionary of words */
    strcpy(dictionary[ 0], "HOP");
    strcpy(dictionary[ 1], "HAT");
    strcpy(dictionary[ 2], "TAP");
    strcpy(dictionary[ 3], "BAT");
    strcpy(dictionary[ 4], "TIP");
    strcpy(dictionary[ 5], "MOP");
    strcpy(dictionary[ 6], "MOM");
    strcpy(dictionary[ 7], "CAT");
    strcpy(dictionary[ 8], "ZOO");
    strcpy(dictionary[ 9], "WAX");
    strcpy(dictionary[10], "TOP");
    strcpy(dictionary[11], "DIP");

    if (issort(dictionary, 12, SPELL_SIZE, compare_str) != 0)
       return 1;

    /* Perform spell checking */
    strcpy(lookup, "hat");
    memset(target, 0, SPELL_SIZE);

    for (i = 0; i < strlen(lookup); i++)
       target[i] = toupper(lookup[i]);

    if (spell(dictionary, 12, target))
       fprintf(stdout, "%s is spelled correctly\n", lookup);
    else
       fprintf(stdout, "%s is not spelled correctly\n", lookup);

    strcpy(lookup, "dop");
    memset(target, 0, SPELL_SIZE);

    for (i = 0; i < strlen(lookup); i++)
       target[i] = toupper(lookup[i]);

    if (spell(dictionary, 12, target))
       fprintf(stdout, "%s is spelled correctly\n", lookup);
    else
       fprintf(stdout, "%s is not spelled correctly\n", lookup);

    strcpy(lookup, "dip");
    memset(target, 0, SPELL_SIZE);

    for (i = 0; i < strlen(lookup); i++)
       target[i] = toupper(lookup[i]);

    if (spell(dictionary, 12, target))
       fprintf(stdout, "%s is spelled correctly\n", lookup);
    else
       fprintf(stdout, "%s is not spelled correctly\n", lookup);

    return 0;

}
Example #30
0
	void ISpell::onWake(){
		_currentTime = _duration;
		spell();
	} // onWake