int cmd_lifeshift(string str) { object tp=this_player(); object env=environment(tp); object tgt; int amt, cost; if (!spell()) return 0; if (str) tgt=present(str, env); if (!can_cast(tp, tgt)) return 0; amt = tp->query_skill("necromancy")*1.65; if (amt > tp->query_max_hp()*0.6) amt = tp->query_max_hp()*0.6; amt -= random(amt/10); cost = amt*0.6; if (tp->query_mp() < cost) FAIL("You need more magic power."); message("magic", COL+"You to"+COL2+"uc"+COL+"h "+tgt->query_cap_name()+ " and tr"+COL2+"ansfe"+COL+"r some of your "+COL2+"life force"+COL+ " into "+tgt->query_objective()+"."+RES, tp); message("magic", COL+tp->query_cap_name()+" to"+COL2+"uc"+COL+"hes you " " and tr"+COL2+"ansfe"+COL+"rs some "+COL2+"life force"+COL+ " into you."+RES, tgt); message("magic", COL+tp->query_cap_name()+" to"+COL2+"uc"+COL+"hes "+ tgt->query_cap_name()+ " and tr"+COL2+"ansfe"+COL+"rs some "+COL2+"life force"+COL+ " into "+tgt->query_objective()+"."+RES, env, ({tp, tgt}) );
int cmd_psicloak(string str) { object tp = this_player(); object env = environment(tp); int time, strength, cost, md; if (!spell()) return 0; if (!can_cast(tp)) return 0; time = tp->query_stats("wisdom")*3; time += random(tp->query_level()); strength = 1 + tp->query_skill("magic defense")/35; strength += random(2); if (strength > 5) strength = 5 + (strength-5)/3; md = 5*((tp->query_level()-10)/5); cost = time * 70 / 100; cost += strength * 5; if (tp->query_mp() < cost) FAIL("Too low on magic."); tp->add_mp(-cost); tp->set_magic_round(2); message("magic", COL+"You begin to shape your "+ COL2+"psionic"+COL+" energy."+RES, tp); call_out("start_psicloak", 2, ({ tp, strength, time, md }) );
int cmd_whack(string str) { object tp = this_player(); object env = environment(tp); object tgt, wep; object *weps; string wepname; if (!abil()) return 0; if (str) tgt = present(str, env); else tgt = tp->query_current_attacker(); weps = filter(tp->query_wielded(), (: $1->query_type() == "blunt" :) ); if (!can_cast(tp, tgt, weps)) return 0; wep = weps[random(sizeof(weps))]; wepname = remove_article(strip_color(wep->query_short())); wepname = replace_string(wepname, " (wielded)", ""); message("combat", "You spin your "+wepname+" around.", tp); message("combat", tp->query_cap_name()+" spins "+tp->query_possessive()+ " "+wepname+" around.", env, tp); tp->set_disable(2); call_out("do_whack_hit", 2, ({ tp, env, tgt, wep, wepname }) );
int cmd_focus(string str) { object tp=this_player(); object env=environment(tp); int heal, cost; if (!abil()) return 0; if (!can_cast(tp)) return 0; heal = tp->query_level(); heal += random(heal*2); heal += tp->query_skill("healing")*1.2; heal += tp->query_skill("faith")/4; heal += tp->query_stats("wisdom")*3/4; if (heal > 150) heal = 150+(heal-150)/3; cost = heal/3.3; if (tp->query_mp() < cost) FAIL("Your magic is too low."); tp->add_mp(-cost); tp->set_disable(2); tp->set(FOCUS_PROP, time()); tp->add_sp(heal); message("magic", COL+"You focus your chi into a boost of energy."+RES, tp); message("magic", COL+tp->query_cap_name()+" focuses inward."+RES, env, tp); return 1; }
int cmd_case(string str) { object tp = this_player(); object env = environment(tp); object tgt; int value, tmp, s; mapping currval; if (!abil()) return 0; if (str) { tgt = present(str, env); if (!tgt || !tgt->is_living()) tgt = present(str, tp); } if (!can_cast(tp, tgt, str)) return 0; tp->set_disable(); tp->add_sp(-(3+random(3))); tmp = 100 - (tp->query_skill("stealing")/4 + tp->query_skill("perception")/5 + tp->query_stats("intelligence")/3); if (tmp < 0) tmp = 0; if (tgt->is_living()) { value = BALANCE3_D->get_steal(tp, tgt, 1, ({ "stealing", "stealth" }),
int cmd_evaluate(string str) { object tp=this_player(); object env=environment(tp); object tgt; mapping bod; string *limbs; string rep; if (!abil()) return 0; if (str) tgt = present(str, env); if (!can_cast(tp, tgt)) return 0; bod = tgt->query_body_mapping(); // lowest ac limb at limbs[0] limbs = sort_array(keys(bod), function (string a, string b, object tgt) { if (tgt->query_ac(a) > tgt->query_ac(b)) return 1; if (tgt->query_ac(a) < tgt->query_ac(b)) return -1; else return 0; }, tgt);
int cmd_sanctuary(string str) { object tp = this_player(); object env = environment(tp); int cost, time; if (!spell()) return 0; if (!can_cast(tp)) return 0; time = tp->query_stats("wisdom")*3; time += tp->query_skill("faith")/5; time += tp->query_skill("magic defense"); cost = 250 + time/10; cost += random(30); if (tp->query_mp() < cost) FAIL("Not enough magic."); tp->add_mp(-cost); tp->set_magic_round(2); message("magic", COL+"You pray to sanctify this place."+RES, tp); message("magic", COL+tp->query_cap_name()+" says a prayer."+RES, env, tp); call_out("sanctuary_on", 2, ({ env, time }) );
int cmd_vigor(string str) { object tp=this_player(); object tgt; int h, f, wis, cost, amt, len; if (!spell()) return 0; if (!str || str == "") return notify_fail("Cast it on who?\n"); if (str == "me") tgt=tp; else if (!(tgt=present(str,environment(tp)))) return notify_fail("You don't see "+str+" here."); if (!can_cast(tp, tgt)) return 0; h=tp->query_skill("healing"); f=(tp->query_skill("faith")/2 + tp->query_skill("belief")*3/2)/2; wis=tp->query_stats("wisdom"); amt=(h+f/2+wis)/15; len=h/2+wis/2; cost=(h+f/2+wis)*2/3; if (tp->query_mp() < cost) return notify_fail("You don't have enough mana for that.\n"); tp->add_mp(-(cost+random(10))); tgt->set("vigor_spell",amt); call_out("devigor",len,({tgt}));
int cmd_teleport(string str) { object tp = this_player(); string destname, itemname, cmd; if (!spell()) return 0; if (!can_cast(tp)) return 0; if (!str || str == "") FAIL("Teleport what to where?"); if (sscanf(str, "%s to %s", itemname, destname) == 2) return teleport_item(tp, itemname, destname); else if (sscanf(str, "to %s", destname) == 1) return teleport_self(tp, destname); else if (sscanf(str, "%s %s", cmd, destname) == 2) return teleport_manage(tp, cmd, destname); else if (str == "list") return teleport_manage(tp, "list", ""); else return teleport_self(tp, str); }
int cmd_dodge(string str) { object tp = this_player(); object env = environment(tp); int rounds, bonus, cost; if (!abil()) return 0; if (!can_cast(tp)) return 0; rounds = 5 + tp->query_level()/10; rounds += tp->query_skill("defense")/(4*9); if (rounds > 8) rounds = 8 + ((rounds-8)/2); if (rounds > 12) rounds = 12 + ((rounds-12)/2); bonus = tp->query_skill("agility"); cost = rounds*3 + bonus/11; if (tp->query_sp() < cost) FAIL("You are too tired."); tp->add_sp(-cost); tp->add_skill_bonus("defense", bonus, rounds*2); tp->set(DODGE_PROP, time()+rounds*2); message("combat", "You "+COL+"dodge"+RES+" around, trying not to get hit.", tp); message("combat", tp->query_cap_name()+" starts to "+COL+"dodge"+RES+ " back and forth.", env, tp); return 1; }
int can_cast(object tp, string type) { object env; string what; mixed *err; if (!tp) return 0; if (tp->query_disable() || tp->query_casting() || tp->query_magic_round()) FAIL("You are busy.\n"); if (member_array(type, keys(reqs)) == -1) FAIL("You cannot build that.\n"); err=check_resources(tp, type); if (stringp(err[0])) FAIL("You do not have enough "+err[0]+" to make a "+type+".\n"); env = environment(tp); if (present("build_"+type+"_ob",env)) FAIL("There is already a "+type+" here.\n"); switch (type) { case "shelter": if (env->query_property("shelter")) FAIL("You cannot build a shelter inside a shelter!\n"); break; default: } return 1; } int cmd_build(string str) { object tp=this_player(); object env=environment(tp); if (!abil()) return 0; if (!str || str == "") FAIL("Build what?\n"); if (str == "campfire") str = "fire"; if (!can_cast(tp, str)) return 0; tp->set_disable(); tp->set_paralyzed(6,"You are busy building a "+str+"."); tp->add_sp(-(20+random(10))); message("info", "You begin to build a "+str+".", tp); message("info", tp->query_cap_name()+" begins to build a "+str+".", env, tp); call_out("build_"+str, 6, ({tp}) );
int cmd_amnesia(string str) { object tp = this_player(); object env = environment(tp); object tgt; int time, howmany, cost; class Effect am; object cmd; if (!spell()) return 0; if (str) tgt = present(str, env); else tgt = tp->query_current_attacker(); if (!can_cast(tp, tgt)) return 0; time = 10; time += tp->query_stats("wisdom")/2; time += tp->query_skill("conjuring")/4; time -= tgt->query_stats("wisdom") * 80 / 100; if (time < 10) time = 10; howmany = 1 + random(2); howmany += (tp->query_stats("intelligence")-50)/40; howmany += (tp->query_skill("psionics")-160)/60; howmany -= tgt->query_skill("magic defense") / 30; if (howmany > 4) howmany = 4; if (howmany < 1) howmany = 1; cost = 150 + time*3 + howmany*40 + random(20); if (tp->query_mp() < cost) FAIL("Too low on magic."); if (!(cmd = new(CMD_OB))) FAIL("An error occurred, please contact a staff member."); cmd->set_catchall(1); cmd->set_function(this_object(), "catch_amnesia"); cmd->set_notify("notify_amnesia"); am = new(class Effect); am->name = "amnesia"; am->caster = tp; am->castername = tp->query_name(); am->target = tgt; am->desc = "You seem to have forgotten some of your abilities."; am->endtime = time() + time; am->endfunc = (: end_amnesia :); am->endmessages = ({ COL+"Your memory finally comes back to you."+RES, COL+tgt->query_cap_name()+" seems to remember something."+RES, });
void FirmOffensive::disp_main_menu(int refreshFlag) { Firm::put_info(refreshFlag); button_cast.create( INFO_X1 +13, INFO_Y1 +259, 'A', "GBA-1" ); if( !should_show_info() ) return; vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("BLDGBASE") ); // display delay if( cast_delay > 0 ) { short* hitPointBitmap =NULL; int ratio = cast_delay *40 / cast_delay_max; int size = cast_delay *76 / cast_delay_max; //106 x 35 --- 15 to 90 ie. 0 to 40 int offsetX = -35; int offsetY = -40; hitPointBitmap = (short *)mem_add( BitmapW::size(15 +size, 35) ); if (ratio <11) vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_10")); else if (ratio <40) vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_39")); else vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_40")); vga.active_buf->read_bitmapW( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, INFO_X1 +94 +20 +size +offsetX, INFO_Y1 +80 +offsetY, hitPointBitmap ); vga.active_buf->put_bitmap_trans( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, image_spict.read("MTR_00")); vga.active_buf->put_bitmapW( INFO_X1 +80 +20 +offsetX, INFO_Y1 +49 +offsetY, hitPointBitmap ); mem_del( hitPointBitmap ); } if( !is_own() ) return; char fileName[] = "GBA-1"; if (button_cast.enable_flag) fileName[4] = '1' + (char) (sys.frame_count%3); button_cast.update_bitmap( fileName ); button_cast.enable_flag = can_cast(magic_id_upper_limit); button_cast.paint(); }
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; }
int cmd_flash(string str) { object tp = this_player(); object env = environment(tp); object tgt; object *weps; int time, hit, miss; if (!abil()) return 0; if (str) tgt = present(str, env); else tgt = tp->query_current_attacker(); weps = filter(tp->query_wielded(), (: ($1->query_type() == "blade" || $1->query_type() == "knife") :) ); if (!can_cast(tp, tgt, weps)) return 0; tp->add_sp(-(3+random(5))); hit = tp->query_skill("blade"); hit += tp->query_skill("entertainment"); hit += tp->query_level(); if (sizeof(weps) > 1 && tp->query_skill("double wielding") >= 20*5) hit += hit*15/100; if (tp->query_current_attacker()) hit -= hit*20/100; miss = tgt->query_skill("defense"); miss += tgt->query_skill("perception"); miss += tgt->query_level(); if (tgt->query(FLASH_PROP) > time() || tgt->query_property("no blind")) miss = hit+50; hit -= miss; if (hit < 1) { message("info", "You try to blind "+tgt->query_cap_name()+", but "+ tgt->query_subjective()+" notices your attempt!", tp); message("info", "You notice "+tp->query_cap_name()+" trying to " "flash light into your eyes!", tgt); message("info", tp->query_cap_name()+" tries to flash light into "+ tgt->query_cap_name()+"'s eyes, but fails.", env, ({ tp, tgt }) );
int cmd_swoop(string str) { object tp = this_player(); object env = environment(tp); object tgt; string *skills; int dmg, cost, rank; int miss = 0; if (!abil()) return 0; if (str) tgt = present(str, env); else tgt = tp->query_current_attacker(); if (!can_cast(tp, tgt)) return 0; skills = ({ "attack", "flying", "flying" });
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 }) );
int cmd_stab(string str) { object tp=this_player(); object env=environment(tp); object tgt; object *weps; string wep, limb; string *skills; int cost, dmg, rank, wc, tmp; float tmpf; class Effect check; int focus; if (!abil()) return 0; if (str) tgt = present(str, env); else tgt = tp->query_current_attacker(); weps = filter(tp->query_wielded(), (: $1->query_type() == TYPE :) ); if (!can_cast(tp, tgt, weps)) return 0; focus = ((check = tp->query_effect("focus")) && check->misc[0] == TYPE); if (tp->query_skill("attack") >= 40) { if (focus && tp->query_skill(TYPE) >= 240) rank = 4; if (tp->query_skill(TYPE) >= 160) rank = 3; else if (tp->query_skill(TYPE) >= 75) rank = 2; else rank = 1; } else rank = 1; // --- skills --- skills = SKILLS; if (sizeof(tp->query_wielded()) > 1) { for (int i = 0; i < DWMOD; i++) skills += ({ "double wielding" }); }
int cmd_flop(string str) { object tp = this_player(); object env = environment(tp); int def, time, level, hp; if (!abil()) return 0; if (!can_cast(tp)) return 0; def = 0; time = 2; level = tp->query_level(); hp = tp->query_hp(); // purposely let these fall through switch (level) { default: def = 50; break; case 36..500: def += level/5 + 1; case 21..35: def += level/3 + 5; case 11..20: def += level/2 + 10 + random(15); case 1..10: def += level*5 + 25 + random(10); } message("info", "You "+COL+"flop"+RES+" down on the ground.", tp); message("info", tp->query_cap_name()+" "+COL+"flops"+RES+ " down on the ground.", env, tp); tp->set_rest_type(LAY); tp->set_disable(1); tp->add_skill_bonus("defense", def, time); tp->do_damage("random", level/2+random(level/3), DAMAGE_PHYSICAL | DAMAGE_IMPACT, DAMAGE_NO_SEVER | DAMAGE_NONLETHAL, tp); return 1; }
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 }) );
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);