本文整理汇总了PHP中createstring函数的典型用法代码示例。如果您正苦于以下问题:PHP createstring函数的具体用法?PHP createstring怎么用?PHP createstring使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createstring函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: titans_load_battle
function titans_load_battle($id)
{
global $session, $badguy, $battle;
$titan = titans_get_titan($id);
if ($titan && !$titan['battlelog']['killed']) {
restore_buff_fields();
$creature = $titan['creature'];
$creature['titaninfo']['badguy']['hpstart'] = $creature['creaturehealth'];
$creature['titaninfo']['player']['hpstart'] = $session['user']['hitpoints'];
$badguy = $creature;
calculate_buff_fields();
$session['user']['badguy'] = createstring($badguy);
$battle = true;
return $titan;
} else {
redirect("runmodule.php?module=titans&titanop=battleover");
return false;
}
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:19,代码来源:lib.php
示例2: ferryman_fight
function ferryman_fight()
{
$op = httpget("op");
global $session;
$from = "forest.php?";
if ($op == "fightferryman") {
$badguy = array("creaturename" => translate_inline("`7The Ferryman`0"), "creaturelevel" => $session['user']['level'] + 2, "creatureweapon" => translate_inline("Ferry Pole"), "creatureattack" => $session['user']['attack'], "creaturedefense" => $session['user']['defense'], "creaturehealth" => round($session['user']['maxhitpoints'], 0), "diddamage" => 0, "didsurprise" => 1, "type" => "ferryman");
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
httpset('op', "fight");
}
if ($op == "run") {
output("`2With nothing but murky water all around, you have nowhere to run!`n`n");
$op = "fight";
httpset('op', "fight");
}
if ($op == "fight") {
$battle = true;
}
if ($battle) {
require_once "battle.php";
if ($victory) {
output("`n`@You have managed to defeat the Ferryman!");
output("You cautiously approach the body, and suddenly, it shimmers and disappears before your eyes!`n`n");
if ($session['user']['hitpoints'] <= 0) {
output("`n`n`^Using a bit of river weed, you are able to staunch your own wounds, stopping your bloodloss before you are completely dead.`n");
$session['user']['hitpoints'] = 1;
}
output("`2Without the ferryman, you are left to drift with the river currents.");
output("It takes a long time, but you eventually get to the other shore.`n`n");
if ($session['user']['hitpoints'] <= 0) {
output("`n`n`^Your staunch your own wounds with a bit of moss growing nearby, stopping your bloodloss before you are completely dead.`n");
$session['user']['hitpoints'] = 1;
}
$maxfflost = get_module_setting("maxfflost");
if ($session['user']['turns'] < $maxfflost) {
$lostff = $session['user']['turns'];
} else {
$lostff = $maxfflost;
}
$session['user']['turns'] -= $lostff;
output("`&You have lost some Stamina!");
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
} elseif ($defeat) {
require_once "lib/taunt.php";
$taunt = select_taunt_array();
$lostgold = $session['user']['gold'];
output("`n`@You have been killed by the Ferryman!");
output("As your last breath escapes you, all you hear is haunting laughter.");
addnav("Daily News", "news.php");
addnews("`%%s `7was last seen aboard a small boat.`0", $session['user']['name']);
debuglog("killed by Ferryman, losing {$lostgold}");
$session['user']['gold'] = 0;
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
} else {
fightnav(true, true);
}
}
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:61,代码来源:ferryman.php
示例3: jewelmonster_runevent
function jewelmonster_runevent($type, $link)
{
global $session;
$op = httpget('op');
$session['user']['specialinc'] = "module:jewelmonster";
$battle = false;
switch ($op) {
case "":
case "search":
$count = 0;
if (is_module_active("jeweler")) {
$count = get_module_pref("totalheld", "jeweler");
}
output("`3While searching for gems and gold, you feel a shadow fall upon you.");
output("With a terrible sense of foreboding, you raise your head.");
output("The creature before your eyes terrifies you to the bone.");
output("`3From a scaly neck emerges the %s's head of horror, huge tusks leaning towards you in a menacing manner.`n`n", translate_inline(get_module_setting("name")));
if ($count > 0) {
output("Catching sight of your jeweled adornments, it rears back for a moment, before moving towards you once again and snarling.");
}
output("`3Snakes in its hair tell you this fight is very real, and you had best prepare!");
addnav("Fight", $link . "op=pre");
break;
case "pre":
$op = "fight";
httpset("op", $op);
$count = 0;
if (is_module_active("jeweler")) {
$count = get_module_pref("totalheld", "jeweler");
}
if ($session['user']['dragonkills'] <= get_module_setting("dk")) {
$count += get_module_setting("grace");
}
$hpl = get_module_setting("hploss") * $count;
if ($count == $session['user']['dragonkills'] || $count == 10) {
$monhp = round($session['user']['maxhitpoints'] + 10) - $hpl;
$monatk = $session['user']['attack'] * 1.1;
$mondef = $session['user']['defense'] * 1.1;
} else {
$monhp = round($session['user']['maxhitpoints'] + 40) - $hpl;
$monatk = round($session['user']['attack']) * 1.2;
$mondef = round($session['user']['defense']) * 1.2;
}
# if we have a too small hp, just set it to something more reasonable.
if ($monhp < 10) {
$monhp = $session['user']['maxhitpoints'] + $hpl / 2;
}
// even out his strength a bit
$badguylevel = $session['user']['level'] + 1;
if ($session['user']['level'] > 9) {
$monhp *= 1.05;
}
if ($session['user']['level'] < 4) {
$badguylevel--;
}
$badguy = array("creaturename" => translate_inline(get_module_setting("name")), "creatureweapon" => translate_inline("Beak of Doom"), "creaturelevel" => $badguylevel, "creaturehealth" => round($monhp), "creatureattack" => $monatk, "creaturedefense" => $mondef, "noadjust" => 1, "diddamage" => 0, "type" => "jewelmonster");
$session['user']['badguy'] = createstring($badguy);
break;
}
if ($op == "fight") {
$battle = true;
}
if ($battle) {
include "battle.php";
if ($victory) {
output("`n`n`3You have overcome %s!", translate_inline(get_module_setting("name")));
if (get_module_pref("totalheld", "jeweler") > 0) {
output("Your jewelry burns your skin, as if to remind you of your narrow escape.`n`n");
}
output("You aren't waiting around to see if it is dead or just resting!`n`n");
if ($session['user']['hitpoints'] <= 0) {
output("`n`n`^With the last of your energy, you press a piece of cloth to your wounds, stopping your bloodloss before you are completely dead.`n");
$session['user']['hitpoints'] = 1;
}
$exp = round($session['user']['experience'] * get_module_setting("expgain"));
// even out the gain a bit... it was too huge at the top and pathetic at the bottom
if ($session['user']['level'] > 9) {
$exp *= 0.8;
}
if ($session['user']['level'] < 6) {
$exp *= 1.2;
}
if ($session['user']['level'] == 1) {
$exp += 20;
}
// to stop people sometimes gaining 2 xp
$exp = round($exp);
output("`3The fight earns you `^%s `3experience.`0", $exp);
$session['user']['experience'] += round($exp);
$badguy = array();
$session['user']['badguy'] = "";
$session['user']['specialinc'] = "";
} elseif ($defeat) {
$badguy = array();
$session['user']['badguy'] = "";
$session['user']['specialinc'] = "";
output("`n`n`3With one final crushing blow, %s pins you to the ground.", translate_inline(get_module_setting("name")));
if ($session['user']['gold'] > 10) {
output("While you lie there, helpless, its snake hair extricates some of your gold.");
$lost = round($session['user']['gold'] * 0.2, 0);
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:jewelmonster.php
示例4: tatmonster_runevent
function tatmonster_runevent($type, $link)
{
global $session;
// Handle the case where Petra gets deactivated.
if (!is_module_active("petra")) {
output("You hear a rustling in the underbrush, which dies away after a few moments.`n`n");
output("When nothing at all happens after a couple of minutes, you continue on your way.");
return;
}
$op = httpget('op');
require_once "lib/partner.php";
$partner = get_partner();
$session['user']['specialinc'] = "module:tatmonster";
$battle = false;
switch ($op) {
case "":
case "search":
output("`3Walking down a deserted trail, you hear a rustling sound coming from the bushes.");
output("You can smell something burning, and hear something churning.");
output("You have no idea if you should check it out, but your curiosity is getting the upper hand.");
output("`3As you step closer and closer to the bush, the burning scent gets more pronounced and the churning grows louder and louder.`n`n");
if (get_module_pref("tatnumber", "petra") > 0) {
output("You feel a brief burning sensation from the tattoos on your arm, as if they are reacting to something!`n`n");
}
output("`3There is a feeling of dread, deep in your bones.");
output("Do you want to wait and see what is making the noise, or flee?");
addnav("W?Wait", $link . "op=wait");
addnav("R?Run", $link . "op=flee");
break;
case "flee":
$charmloss = e_rand(get_module_setting("mincharmloss") * 2, get_module_setting("maxcharmloss") * 2);
output("`3Turning around, you hasten back the way you came.");
output("With a glance backwards, you see a stray cat come out of the trees.`n`n");
output("Face red with shame, you don't know if you'll ever be able to let %s`3 know that you got scared by a cat!`n`n", $partner);
output("You lose %s charm from the shame of your cowardice.", $charmloss);
debuglog("lost {$charmloss} charm from cowardice to the tatmonster");
$session['user']['charm'] -= $charmloss;
if ($session['user']['charm'] < 0) {
$session['user']['charm'] = 0;
}
$session['user']['specialinc'] = "";
break;
case "wait":
output("`3You wait for a moment to see what transpires.`n`n");
output("`3Out from the bushes springs the Mighty `#%s`3.", get_module_setting("name"));
output("It lashes out with its three slobbering maws, each of them snarling and growling.");
output("As you rear back in fear, one of the powerful heads narrowly misses you with its teeth.`n");
output("Circling around you, the beast blocks your escape!`n");
addnav("Fight", $link . "op=pre");
break;
case "pre":
$op = "fight";
httpset("op", $op);
// accommodate for data left from older versions of petra
require_once "modules/petra.php";
petra_calculate();
// Lets build the Tat Monster NOW!
$numtats = get_module_pref("tatpower", "petra");
if ($session['user']['dragonkills'] <= get_module_setting("dk")) {
$numtats += get_module_setting("grace");
}
$hpl = get_module_setting("hploss") * $numtats;
// the test needs to be changed so that it no longer
// either assumes that one can only obtain ten tattoos,
// or that $numtats is an integer
// JT: changed to 8.4 so existing behaviour was preserved.
if (floor($numtats) == $session['user']['dragonkills'] || $numtats >= 8.4) {
$monhp = round($session['user']['maxhitpoints'] * 1.1) - $hpl;
$monatk = round($session['user']['attack'] * 1.05);
$mondef = round($session['user']['defense'] * 1.05);
} else {
$monhp = round($session['user']['maxhitpoints'] * 1.5) - $hpl;
$monatk = round($session['user']['attack'] * 1.15);
$mondef = round($session['user']['defense'] * 1.15);
}
// If we have too small hp, then just set the monster = to
// the players hitpoints + 20 %.
if ($monhp <= 10) {
$monhp = round($session['user']['maxhitpoints'] * 1.2);
}
// even out his strength a bit
$badguylevel = $session['user']['level'] + 1;
if ($session['user']['level'] > 9) {
$monhp *= 1.05;
}
if ($session['user']['level'] > 3) {
$badguylevel--;
}
$badguy = array("creaturename" => translate_inline(get_module_setting("name")), "creatureweapon" => translate_inline("Slobbering Maws"), "creaturelevel" => $session['user']['level'] + 1, "creaturehealth" => round($monhp), "creatureattack" => $monatk, "creaturedefense" => $mondef, "noadjust" => 1, "diddamage" => 0);
$attackstack = array("enemies" => array($badguy), "options" => array("type" => "tattoomonster"));
$session['user']['badguy'] = createstring($attackstack);
break;
}
if ($op == "fight") {
$battle = true;
}
if ($battle) {
include "battle.php";
if ($victory) {
output("`n`n`3You have overcome the beast!");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:tatmonster.php
示例5: dwellings_pvp_run
function dwellings_pvp_run()
{
global $session, $badguy, $pvptime, $pvptimeout, $options;
$pvptime = getsetting("pvptimeout", 600);
$pvptimeout = date("Y-m-d H:i:s", strtotime("-{$pvptime} seconds"));
$last = date("Y-m-d H:i:s", strtotime("-" . getsetting("LOGINTIMEOUT", 900) . " sec"));
$ac = db_prefix("accounts");
$mu = db_prefix("module_userprefs");
$dw = db_prefix("dwellings");
$cl = db_prefix("clans");
$op = httpget('op');
$dwid = httpget('dwid');
page_header("Dwellings PvP");
if ($op != "fight1" && $op != "fight") {
require_once "modules/dwellings_pvp/run/case_{$op}.php";
}
if ($op == "fight1") {
$name = rawurldecode(httpget('name'));
require_once "modules/dwellings/lib.php";
if (is_numeric($name)) {
$name = getlogin($name);
}
require_once "lib/pvpsupport.php";
$badguy = setup_target($name);
require_once "lib/battle-skills.php";
suspend_buffs("allowinpvp", "`&The gods prevent you from using any special abilities!`0");
$session['user']['badguy'] = createstring($badguy);
$session['user']['playerfights']--;
$op = "fight";
}
if ($op == "fight") {
$options['type'] = 'pvp';
$battle = true;
}
if ($battle) {
include "battle.php";
if ($victory) {
$killedin = sprintf("%s Dwellings", $session['user']['location']);
require_once "lib/pvpsupport.php";
pvpvictory($badguy, $killedin, $options);
addnews("`4%s`3 defeated `4%s`3 while they were sleeping in their Dwelling.", $session['user']['name'], $badguy['creaturename']);
$badguy = array();
unsuspend_buffs("allowinpvp", "`&The gods have restored your special abilities!`0");
addnav("Leave");
addnav("Hamlet Registry", "runmodule.php?module=dwellings&op=list&ref=hamlet");
} elseif ($defeat) {
$killedin = sprintf("%s Dwellings", $session['user']['location']);
require_once "lib/taunt.php";
$taunt = select_taunt_array();
require_once "lib/pvpsupport.php";
pvpdefeat($badguy, $killedin, $taunt, $options);
unsuspend_buffs("allowinpvp", "`&The gods have restored your special abilities!`0");
addnews("`4%s`3 was defeated while attacking `4%s`3 as they were sleeping in their Dwelling.`n%s", $session['user']['name'], $badguy['creaturename'], $taunt);
output("`n`n`&You are sure that someone, sooner or later, will stumble over your corpse and return it to %s for you.", $session['user']['location']);
addnav("Return to the Shades", "shades.php");
} else {
$script = "runmodule.php?module=dwellings_pvp&op=fight";
require_once "lib/fightnav.php";
fightnav(false, false, $script);
}
}
page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:63,代码来源:dwellings_pvp.php
示例6: unset
$defeat = false;
} else {
if ($session['user']['hitpoints'] <= 0) {
$defeat = true;
$victory = false;
} else {
$defeat = false;
$victory = false;
}
}
if ($victory || $defeat) {
// Unset the bodyguard buff at the end of the fight.
// Without this, the bodyguard persists *and* the older buffs are held
// off for a while! :/
if (isset($session['bufflist']['bodygaurd'])) {
unset($session['bufflist']['bodyguard']);
}
if (!is_array($session['bufflist']) || count($session['bufflist']) <= 0) {
$session['bufflist'] = unserialize($session['user']['buffbackup']);
if (is_array($session['bufflist'])) {
if (count($session['bufflist']) > 0 && $badguy[pvp]) {
output("`&The gods have restored your special effects.`n`n");
}
} else {
$session['bufflist'] = array();
}
}
$session['user']['buffbackup'] = "";
}
$session['user']['badguy'] = createstring($badguy);
示例7: e_rand
$session['user']['seenmaster'] = 0;
}
if ($session[user][seenmaster]){
output("You think that, perhaps, you've seen enough of your master for today, the lessons you learned earlier prevent you from so willingly ");
output("subjecting yourself to that sort of humiliation again.");
addnav("Return to the village","village.php");
}else{
if (getsetting("multimaster",1)==0) $session['user']['seenmaster'] = 1;
if ($session[user][experience]>=$exprequired){
$atkflux = e_rand(0,$session['user']['dragonkills']);
$defflux = e_rand(0,($session['user']['dragonkills']-$atkflux));
$hpflux = ($session['user']['dragonkills'] - ($atkflux+$defflux)) * 5;
$master['creatureattack']+=$atkflux;
$master['creaturedefense']+=$defflux;
$master['creaturehealth']+=$hpflux;
$session[user][badguy]=createstring($master);
$battle=true;
if ($victory) {
$badguy = createarray($session['user']['badguy']);
output("With a flurry of blows you dispatch your master.`n");
}
}else{
output("You ready your ".$session[user][weapon]." and ".$session[user][armor]." and approach `^$master[creaturename]`0.`n`nA small crowd of onlookers ");
output("has gathered, and you briefly notice the smiles on their faces, but you feel confident. You bow before `^$master[creaturename]`0, and execute ");
output("a perfect spin-attack, only to realize that you are holding NOTHING! `^$master[creaturename]`0 stands before you holding your weapon. ");
output("Meekly you retrieve your ".$session[user][weapon].", and slink out of the training grounds to the sound of boisterous guffaws.");
addnav("Return to the village.","village.php");
$session[user][seenmaster]=1;
}
}
示例8: worldmapen_run_real
//.........这里部分代码省略.........
}
}
//Check if we're removing a turn when the player encounters a monster, and if so, do it
if ($useturns == 1) {
$session['user']['turns']--;
}
//Fix to only search for Forest type creatures, added by CavemanJoe
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel = '{$session['user']['level']}' AND forest = 1 ORDER BY rand(" . e_rand() . ") LIMIT 1";
$result = db_query($sql);
restore_buff_fields();
if (db_num_rows($result) == 0) {
// There is nothing in the database to challenge you,
// let's give you a doppleganger.
$badguy = array();
$badguy['creaturename'] = "An evil doppleganger of " . $session['user']['name'];
$badguy['creatureweapon'] = $session['user']['weapon'];
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creaturegold'] = rand($session['user']['level'] * 15, $session['user']['level'] * 30);
$badguy['creatureexp'] = round($session['user']['experience'] / 10, 0);
$badguy['creaturehealth'] = $session['user']['maxhitpoints'];
$badguy['creatureattack'] = $session['user']['attack'];
$badguy['creaturedefense'] = $session['user']['defense'];
} else {
$badguy = db_fetch_assoc($result);
require_once "lib/forestoutcomes.php";
$badguy = buffbadguy($badguy);
}
calculate_buff_fields();
$badguy['playerstarthp'] = $session['user']['hitpoints'];
$badguy['diddamage'] = 0;
$badguy['type'] = 'world';
//debug("Worldmap run.php is debugging badguy");
//debug($badguy);
$session['user']['badguy'] = createstring($badguy);
$battle = true;
} else {
// $args = modulehook("count-travels", array('available'=>0, 'used'=>0));
// $free = max(0, $args['available'] - $args['used']);
// if (get_module_setting("usestamina")==1){
// output("`c`nYou think to yourself what a nice day it is.`c`n");
// } else {
// output("`c`nYou think to yourself what a nice day it is.`nYou have %s Travel Points remaining.%s`c`n",$free);
// }
$free = 100;
worldmapen_determinenav();
if (get_module_setting("smallmap")) {
worldmapen_viewsmallmap();
}
if (!$chatoverride) {
require_once "lib/commentary.php";
addcommentary();
$loc = get_module_pref("worldXYZ", "worldmapen");
viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
}
worldmapen_viewmapkey(true, false);
module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
}
$loc = get_module_pref('worldXYZ');
list($x, $y, $z) = explode(",", $loc);
$t = worldmapen_getTerrain($x, $y, $z);
//debug($t);
if ($t['type'] == "Forest") {
$shady = true;
}
} elseif ($op == "gypsy") {
$outdoors = false;
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:67,代码来源:run.php
示例9: output
if ($session['user']['seenmaster']) {
output("You think that, perhaps, you've seen enough of your master for today, the lessons you learned earlier prevent you from so willingly ");
output("subjecting yourself to that sort of humiliation again.");
addnav("Return to the village", "village.php");
} else {
if (getsetting("multimaster", 1) == 0) {
$session['user']['seenmaster'] = 1;
}
if ($session['user']['experience'] >= $exprequired) {
$atkflux = e_rand(0, $session['user']['dragonkills']);
$defflux = e_rand(0, $session['user']['dragonkills'] - $atkflux);
$hpflux = ($session['user']['dragonkills'] - ($atkflux + $defflux)) * 5;
$master['creatureattack'] += $atkflux;
$master['creaturedefense'] += $defflux;
$master['creaturehealth'] += $hpflux;
$session['user']['badguy'] = createstring($master);
$battle = true;
if ($victory) {
$badguy = createarray($session['user']['badguy']);
output("With a flurry of blows you dispatch your master.`n");
}
} else {
output("You ready your " . $session['user']['weapon'] . " and " . $session['user']['armor'] . " and approach `^{$master['creaturename']}`0.`n`nA small crowd of onlookers ");
output("has gathered, and you briefly notice the smiles on their faces, but you feel confident. You bow before `^{$master['creaturename']}`0, and execute ");
output("a perfect spin-attack, only to realize that you are holding NOTHING! `^{$master['creaturename']}`0 stands before you holding your weapon. ");
output("Meekly you retrieve your " . $session['user']['weapon'] . ", and slink out of the training grounds to the sound of boisterous guffaws.");
addnav("Return to the village.", "village.php");
$session['user']['seenmaster'] = 1;
}
}
} else {
示例10: output
output("`\$Error:`4 That user is now online.");
}else{
if ((int)$row[location]!=0 && 0){
output("`\$Error:`4 That user is not in a location that you can attack them.");
}else{
if((int)$row[alive]!=1){
output("`\$Error:`4 That user is not alive.");
}else{
if ($session[user][playerfights]>0){
$sql = "UPDATE accounts SET pvpflag=now() WHERE acctid=$row[acctid]";
db_query($sql);
$battle=true;
$row[pvp]=1;
$row[creatureexp] = round($row[creatureexp],0);
$row[playerstarthp] = $session[user][hitpoints];
$session[user][badguy]=createstring($row);
$session[user][playerfights]--;
$session['user']['buffbackup']="";
pvpwarning(true);
}else{
output("`4Judging by how tired you are, you think you had best not engage in another player battle today.");
}
}
}
}
}
}else{
output("`\$Error:`4 That user was not found! How'd you get here anyhow?");
}
if ($battle){
示例11: round
// or by potions!
$points += (int)(($session['user']['maxhitpoints'] - 150)/5);
// Okay.. *now* buff the dragon a bit.
if ($beta)
$points = round($points*1.5,0);
else
$points = round($points*.75,0);
$atkflux = e_rand(0, $points);
$defflux = e_rand(0,$points-$atkflux);
$hpflux = ($points - ($atkflux+$defflux)) * 5;
$badguy['creatureattack']+=$atkflux;
$badguy['creaturedefense']+=$defflux;
$badguy['creaturehealth']+=$hpflux;
$session[user][badguy]=createstring($badguy);
$battle=true;
}else if($HTTP_GET_VARS[op]=="prologue1"){
output("`@Victory!`n`n");
$flawless = 0;
if ($HTTP_GET_VARS['flawless']) {
$flawless = 1;
output("`b`c`&~~ Flawless Fight ~~`0`c`b`n`n");
}
output("`2Before you, the great dragon lies immobile, its heavy breathing like acid to your lungs. ");
output("You are covered, head to toe, with the foul creature's thick black blood. ");
output("The great beast begins to move its mouth. You spring back, angry at yourself for having been ");
output("fooled by its ploy of death, and watch for its huge tail to come sweeping your way. But it does ");
output("not. Instead the dragon begins to speak.`n`n");
output("\"`^Why have you come here mortal? What have I done to you?`2\" it says with obvious effort. ");
output("\"`^Always my kind are sought out to be destroyed. Why? Because of stories from distant lands ");
示例12: abandoncastle_fight
function abandoncastle_fight($op)
{
page_header("Maze Monster");
global $session, $badguy;
if ($op == "ghost1") {
$badguy = array("creaturename" => translate_inline("`@Disembodied Spectre`0"), "creaturelevel" => 1, "creatureweapon" => translate_inline("ghostly powers"), "creatureattack" => 1, "creaturedefense" => 2, "creaturehealth" => 1000, "diddamage" => 0);
if (e_rand(0, 1)) {
$badguy['hidehitpoints'] = 1;
}
$userattack = $session['user']['attack'] + e_rand(1, 3);
$userhealth = round($session['user']['hitpoints'] / 2);
$userdefense = $session['user']['defense'] + e_rand(1, 3);
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creatureattack'] += $userattack * 0.5;
$badguy['creaturehealth'] += $userhealth;
$badguy['creaturedefense'] += $userdefense * 2;
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
}
if ($op == "ghost2") {
$badguy = array("creaturename" => translate_inline("`@Angry Spectre`0"), "creaturelevel" => 1, "creatureweapon" => translate_inline("ghostly powers"), "creatureattack" => 1, "creaturedefense" => 2, "creaturehealth" => 400, "diddamage" => 0);
if (e_rand(0, 1)) {
$badguy['hidehitpoints'] = 1;
}
$userattack = $session['user']['attack'] + e_rand(1, 3);
$userhealth = round($session['user']['hitpoints'] / 2);
$userdefense = $session['user']['defense'] + e_rand(1, 3);
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creatureattack'] += $userattack * 0.5;
$badguy['creaturehealth'] += $userhealth;
$badguy['creaturedefense'] += $userdefense * 1.5;
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
}
if ($op == "bat") {
$badguy = array("creaturename" => translate_inline("`@Bat`0"), "creaturelevel" => 1, "creatureweapon" => translate_inline("Sharp Fangs"), "creatureattack" => 1, "creaturedefense" => 2, "creaturehealth" => 1, "diddamage" => 0);
if (e_rand(0, 1)) {
$badguy['hidehitpoints'] = 1;
}
$userattack = $session['user']['attack'] + e_rand(1, 3);
$userhealth = round($session['user']['hitpoints'] / 2);
$userdefense = $session['user']['defense'] + e_rand(1, 3);
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creatureattack'] += $userattack * 0.5;
$badguy['creaturehealth'] += round($userhealth * 0.5);
$badguy['creaturedefense'] += $userdefense * 0.5;
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
}
if ($op == "rat") {
$badguy = array("creaturename" => translate_inline("`@Huge Rat`0"), "creaturelevel" => 1, "creatureweapon" => translate_inline("Sharp Fangs"), "creatureattack" => 1, "creaturedefense" => 2, "creaturehealth" => 1, "diddamage" => 0);
if (e_rand(0, 1)) {
$badguy['hidehitpoints'] = 1;
}
$userattack = $session['user']['attack'] + e_rand(1, 3);
$userhealth = round($session['user']['hitpoints'] / 2);
$userdefense = $session['user']['defense'] + e_rand(1, 3);
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creatureattack'] += round($userattack * 0.75);
$badguy['creaturehealth'] += round($userhealth * 0.75);
$badguy['creaturedefense'] += round($userdefense * 0.75);
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
}
if ($op == "minotaur") {
$badguy = array("creaturename" => translate_inline("`@Minotaur`0"), "creaturelevel" => 1, "creatureweapon" => translate_inline("Sharp Fangs"), "creatureattack" => 1, "creaturedefense" => 30, "creaturehealth" => 1000, "diddamage" => 0);
if (e_rand(0, 1)) {
$badguy['hidehitpoints'] = 1;
}
$userattack = $session['user']['attack'] + e_rand(1, 3);
$userhealth = round($session['user']['hitpoints'] / 2);
$userdefense = $session['user']['defense'] + e_rand(1, 3);
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creatureattack'] += $userattack - 4;
$badguy['creaturehealth'] += $userhealth;
$badguy['creaturedefense'] += $userdefense;
$session['user']['badguy'] = createstring($badguy);
$op = "fight";
}
if ($op == "fight" or $op == "run") {
global $badguy;
$battle = true;
$fight = true;
if ($battle) {
$session['user']['specialinc'] = "module:abandoncastle";
require_once "battle.php";
if ($victory) {
output("`b`4You have slain `^%s`4.`b`n", $badguy['creaturename']);
$badguy = array();
$session['user']['badguy'] = "";
$gold = e_rand(50, 250);
$experience = $session['user']['level'] * e_rand(37, 99);
output("`#You receive `6%s `#gold!`n", $gold);
$session['user']['gold'] += $gold;
output("`#You receive `6%s `#experience!`n", $experience);
$session['user']['experience'] += $experience;
$session['user']['specialinc'] = "";
addnav("Continue", "runmodule.php?module=abandoncastle&loc=" . get_module_pref('pqtemp'));
} elseif ($defeat) {
output("As you hit the ground `^%s runs away.", $badguy['creaturename']);
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:abandoncastle.php
示例13: cities_run
//.........这里部分代码省略.........
output("Hey, looks like you managed to travel with out having any forest fights. How'd you swing that?");
debuglog("Travelled with out having any forest fights, how'd they swing that?");
}
}
// Let's give the lower DK people a slightly better chance.
$dlevel = cities_dangerscale($danger);
if (e_rand(0, 100) < $dlevel && $su != '1') {
//they've been waylaid.
if (module_events("travel", get_module_setting("travelspecialchance"), "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1&") != 0) {
page_header("Something Special!");
if (checknavs()) {
page_footer();
} else {
// Reset the special for good.
$session['user']['specialinc'] = "";
$session['user']['specialmisc'] = "";
$skipvillagedesc = true;
$op = "";
httpset("op", "");
addnav("Continue", "runmodule.php?module=cities&op=travel&city=" . urlencode($city) . "&d={$danger}&continue=1");
module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
page_footer();
}
}
$args = array("soberval" => 0.9, "sobermsg" => "`&Facing your bloodthirsty opponent, the adrenaline rush helps to sober you up slightly.", "schema" => "module-cities");
modulehook("soberup", $args);
require_once "lib/forestoutcomes.php";
$sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel = '{$session['user']['level']}' AND forest = 1 ORDER BY rand(" . e_rand() . ") LIMIT 1";
$result = db_query($sql);
restore_buff_fields();
if (db_num_rows($result) == 0) {
// There is nothing in the database to challenge you,
// let's give you a doppleganger.
$badguy = array();
$badguy['creaturename'] = "An evil doppleganger of " . $session['user']['name'];
$badguy['creatureweapon'] = $session['user']['weapon'];
$badguy['creaturelevel'] = $session['user']['level'];
$badguy['creaturegold'] = 0;
$badguy['creatureexp'] = round($session['user']['experience'] / 10, 0);
$badguy['creaturehealth'] = $session['user']['maxhitpoints'];
$badguy['creatureattack'] = $session['user']['attack'];
$badguy['creaturedefense'] = $session['user']['defense'];
} else {
$badguy = db_fetch_assoc($result);
$badguy = buffbadguy($badguy);
}
calculate_buff_fields();
$badguy['playerstarthp'] = $session['user']['hitpoints'];
$badguy['diddamage'] = 0;
$badguy['type'] = 'travel';
$session['user']['badguy'] = createstring($badguy);
$battle = true;
} else {
set_module_pref("paidcost", 0);
//they arrive with no further scathing.
$session['user']['location'] = $city;
redirect("village.php", "Redirected to Village from Multiple Cities module");
}
}
} elseif ($op == "fight" || $op == "run") {
if ($op == "run" && e_rand(1, 5) < 3) {
// They managed to get away.
page_header("Escape");
output("You set off running through the forest at a breakneck pace heading back the way you came.`n`n");
$coward = get_module_setting("coward");
if ($coward) {
modulehook("cities-usetravel", array("foresttext" => array("In your terror, you lose your way and become lost, losing time for a forest fight.`n`n", $session['user']['location']), "traveltext" => array("In your terror, you lose your way and become lost, losing precious travel time.`n`n", $session['user']['location'])));
}
output("After running for what seems like hours, you finally arrive back at %s.", $session['user']['location']);
addnav(array("Enter %s", $session['user']['location']), "village.php");
page_footer();
}
$battle = true;
} elseif ($op == "faq") {
cities_faq();
} elseif ($op == "") {
page_header("Travel");
output("A divine light ends the fight and you return to the road.");
addnav("Continue your journey", "runmodule.php?module=cities&op=travel&city=" . urlencode($city) . "&continue=1&d={$danger}");
module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
page_footer();
}
if ($battle) {
page_header("You've been waylaid!");
require_once "battle.php";
if ($victory) {
require_once "lib/forestoutcomes.php";
forestvictory($newenemies, "This fight would have yielded an extra turn except it was during travel.");
addnav("Continue your journey", "runmodule.php?module=cities&op=travel&city=" . urlencode($city) . "&continue=1&d={$danger}");
module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
} elseif ($defeat) {
require_once "lib/forestoutcomes.php";
forestdefeat($newenemies, array("travelling to %s", $city));
} else {
require_once "lib/fightnav.php";
fightnav(true, true, "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}");
}
page_footer();
}
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:cities.php
示例14: e_rand
$atkflux = e_rand(0, $dk);
$atkflux = min($atkflux, round($dk * 0.25));
$defflux = e_rand(0, $dk - $atkflux);
$defflux = min($defflux, round($dk * 0.25));
$hpflux = ($dk - ($atkflux + $defflux)) * 5;
debug("DEBUG: {$dk} modification points total.`n");
debug("DEBUG: +{$atkflux} allocated to attack.`n");
debug("DEBUG: +{$defflux} allocated to defense.`n");
debug("DEBUG: +" . $hpflux / 5 . "*5 to hitpoints`n");
calculate_buff_fields();
$master['creatureattack'] += $atkflux;
$master['creaturedefense'] += $defflux;
$master['creaturehealth'] += $hpflux;
$attackstack['enemies'][0] = $master;
$attackstack['options']['type'] = 'train';
$session['user']['badguy'] = createstring($attackstack);
$battle = true;
if ($victory) {
$badguy = unserialize($session['user']['badguy']);
$badguy = $badguy['enemies'][0];
output("With a flurry of blows you dispatch your master.`n");
}
} else {
output("You ready your %s and %s and approach `^%s`0.`n`n", $session['user']['weapon'], $session['user']['armor'], $master['creaturename']);
output("A small crowd of onlookers has gathered, and you briefly notice the smiles on their faces, but you feel confident. ");
output("You bow before `^%s`0, and execute a perfect spin-attack, only to realize that you are holding NOTHING!", $master['creaturename']);
output("`^%s`0 stands before you holding your weapon.", $master['creaturename']);
output("Meekly you retrieve your %s, and slink out of the training grounds to the sound of boisterous guffaws.", $session['user']['weapon']);
addnav("Leave");
villagenav();
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:train.php
示例15: modulehook
// Please update all modules, that use the following hook to use the
// $options array instead of the $args array for their code.
$badguy['type'] = $options['type'];
if ($victory) {
$badguy = modulehook("battle-victory", $badguy);
}
if ($defeat) {
$badguy = modulehook("battle-defeat", $badguy);
}
unset($badguy['fightoutput']);
}
}
}
$attackstack = array('enemies' => $newenemies, 'options' => $options);
$session['user']['badguy'] = createstring($attackstack);
$session['user']['companions'] = createstring($companions);
tlschema();
function battle_player_attacks()
{
global $badguy, $enemies, $newenemies, $session, $creatureattack, $creatureatkmod, $beta;
global $creaturedefmod, $adjustment, $defmod, $atkmod, $compatkmod, $compdefmod, $buffset, $atk, $def, $options;
global $companions, $companion, $newcompanions, $roll, $count, $needtostopfighting;
$break = false;
$creaturedmg = $roll['creaturedmg'];
if ($options['type'] != "pvp") {
$creaturedmg = report_power_move($atk, $creaturedmg);
}
if ($creaturedmg == 0) {
output("`4You try to hit `^%s`4 but `\$MISS!`n", $badguy['creaturename']);
process_dmgshield($buffset['dmgshield'], 0);
process_lifetaps($buffset['lifetap'], 0);