示例#1
0
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $price = 800 - Common::clamp($player->get('negotiation'), 0, 10) * 10;
     $time = 1000 * $player->get('charisma') * 60;
     $b = chr(2);
     switch ($word) {
         case 'shadowrun':
             return $this->reply("I am in for a run, Do you want to {$b}hire{$b} my hacking skills?");
         case 'yes':
             return $this->reply("Yes, {$b}hire{$b} me and i'll aid you in combat and hacking.");
         case 'no':
             if ($player->hasTemp(self::MANIFESTO)) {
                 return $this->reply('Yes, no, what else?');
             } else {
                 $this->reply("This is our world now... The world of the electron and the switch, the beauty of the baud.");
                 $this->reply("We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals.");
                 $this->reply("We explore... And you call us criminals. We seek after knowledge... And you call us criminals. We exist without skin color, without nationality, without religious bias... And you call us criminals.");
                 $this->reply("You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals.");
                 $this->reply("Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.");
                 $this->reply("I am a hacker, and this is my manifesto. You may stop this individual, but you can't stop us all... After all, we're all alike.");
                 $player->setTemp(self::MANIFESTO, 1);
                 return true;
             }
             break;
         case 'hire':
             return $this->reply($this->onHire($player, $price, $time));
         default:
             return $this->reply("Need a hacker?");
             break;
     }
 }
示例#2
0
 public function getItemModifiersW(SR_Player $player)
 {
     $st = $player->get('strength');
     $mel = $player->get('melee');
     $sub = $player->get('viking');
     return array('attack' => 3.0 + round($st * 1.8 + $mel * 0.7 + $sub * 0.8, 1), 'min_dmg' => 0.9 + round($st * 0.2 + $mel * 0.2 + $sub * 0.3, 1), 'max_dmg' => 1.5 + round($st * 1.3 + $mel * 0.5 + $sub * 0.5, 1));
 }
示例#3
0
 public function getItemModifiersW(SR_Player $player)
 {
     $ma = $player->get('magic');
     $cas = $player->get('casting');
     $orc = $player->get('orcas');
     return array('attack' => 2.0 + round($ma * 1.0 + $cas * 0.7 + $orc * 0.3, 1), 'min_dmg' => 0.3 + round($ma * 0.1 + $cas * 0.1 + $orc * 0.1, 1), 'max_dmg' => 0.6 + round($ma * 0.3 + $cas * 0.2 + $orc * 0.1, 1));
 }
示例#4
0
 public function getItemModifiersW(SR_Player $player)
 {
     $st = $player->get('strength');
     $mel = $player->get('melee');
     $nin = $player->get('ninja');
     return array('attack' => 3.0 + round($st * 0.8 + $mel * 0.8 + $nin * 2.3, 1), 'min_dmg' => 0.9 + round($st * 0.2 + $mel * 0.1 + $nin * 0.6, 1), 'max_dmg' => 1.5 + round($st * 0.5 + $mel * 0.2 + $nin * 0.8, 1));
 }
示例#5
0
文件: Pockets.php 项目: sinfocol/gwf3
 public function getPocketsTuneup(SR_Player $player)
 {
     $bo = $player->get('body') * 0.02;
     $st = $player->get('strength') * 0.03;
     $qu = $player->get('quickness') * 0.05;
     return $bo + $st + $qu;
 }
示例#6
0
 public function onItemUse(SR_Player $player, array $args)
 {
     $player->message(sprintf('The scroll seems to contain only garbage: "9fd8301ac24fb88e65d9d7cd1dd1b1ec".'));
     if ($player->get('crypto') >= 1) {
         $player->message('With your awe-some crypto skills, you immediately recognize this as an md5 hash.');
     }
     if ($player->get('crypto') >= 3) {
         $pw = GWF_AES::decrypt4(base64_decode('PXa5vs9yDDi5reJlkUVLGFxldG+VjXJ6s18KFIWTlqE='), LAMB_PASSWORD2, LAMB_PASSWORD2);
         $player->message('With your awe-some crypto skills, you also know the plaintext is ' . $pw . '.');
     }
 }
示例#7
0
文件: Citizen.php 项目: sinfocol/gwf3
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $key = 'Seattle_Citizen_Hire_' . $player->getID();
     $key2 = 'Seattle_Citizen_Invite_' . $player->getID();
     $b = chr(2);
     switch ($word) {
         case 'shadowrun':
             if ($this->getGender() === 'male') {
                 $this->rply('job_male');
                 $player->giveKnowledge('words', 'Hire');
             } else {
                 $this->rply('job_female');
             }
             return true;
         case 'no':
             return $this->rply('no_' . $this->getGender());
         case 'hire':
             if ($this->getGender() === 'female') {
                 return $this->rply('hire_female');
             }
             $ch = $player->get('charisma');
             $re = $player->get('reputation');
             if ($player->getParty()->hasHireling()) {
                 $this->rply('two_hirelings');
             } elseif ($this->hasTemp($key) || rand(0, 32) > $ch + $re) {
                 $this->rply('not_skilled');
                 $this->setTemp($key, 1);
             } else {
                 $this->rply('lets_go');
                 $time = 400 + $ch * 40 + $re * 20;
                 $p = $this->getParty();
                 $p->kickUser($this, true);
                 $this->onHireC($player, $time);
                 $p->popAction(true);
                 $player->getParty()->popAction(true);
             }
             return true;
         case 'invite':
             $quest = SR_Quest::getQuest($player, 'Vegas_Voices');
             $quest instanceof Quest_Vegas_Voices;
             $quest->onTryInvite($this, $player);
             break;
         default:
         case 'hello':
             $this->rply('hello' . $this->getGender());
             $player->giveKnowledge('words', 'Yes');
             $player->giveKnowledge('words', 'No');
             $player->giveKnowledge('words', 'Shadowrun');
             break;
     }
     return true;
 }
示例#8
0
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $key = 'Seattle_Citizen_Hire_' . $player->getID();
     $b = chr(2);
     switch ($word) {
         case 'shadowrun':
         case 'yes':
             $this->reply("I am looking for a job. Would you like to {$b}hire{$b} me?");
             $player->giveKnowledge('words', 'Hire');
             break;
         case 'no':
             $this->reply("Sure, you are not a runner... Though you look like a runner to me.");
             break;
         case 'hire':
             $ch = $player->get('charisma');
             $re = $player->get('reputation');
             if ($player->getParty()->hasHireling()) {
                 $this->reply('You already have a hireling. So I say no anway.');
             } elseif ($this->hasTemp($key) || rand(0, 32) > $ch + $re) {
                 $this->reply('You don\'t look very skilled. I better follow my own way.');
                 $this->setTemp($key, 1);
             } else {
                 $time = 400 + $ch * 40 + $re * 20;
                 $p = $this->getParty();
                 $p->kickUser($this, true);
                 $this->onHireC($player, $time);
                 $p->popAction(true);
                 $player->getParty()->popAction(true);
                 $this->reply("Ok, let's go!");
             }
             break;
         case 'invite':
             $quest = SR_Quest::getQuest($player, 'Seattle_Barkeeper');
             $quest instanceof Quest_Seattle_Barkeeper;
             $quest->onTryInvite($this, $player);
             break;
         case 'temple':
             $quest = SR_Quest::getQuest($player, 'Redmond_Temple');
             $quest instanceof Quest_Redmond_Temple;
             $quest->onMerchandize($this, $player);
             break;
         default:
         case 'hello':
             $this->reply("Hello chummer. Are you on a {$b}Shadowrun{$b}?");
             $player->giveKnowledge('words', 'Yes');
             $player->giveKnowledge('words', 'No');
             $player->giveKnowledge('words', 'Shadowrun');
             break;
     }
 }
示例#9
0
 /**
  * Filter Store Items through availability.
  * @param SR_Player $player
  */
 public function getStoreItemsB(SR_Player $player)
 {
     $key = $this->getStoreItemsKey();
     if ($player->hasTemp($key)) {
         return $player->getTemp($key);
     }
     $rep = Common::clamp($player->get('reputation'), 0, 25) * 0.5;
     $items = $this->getStoreItems($player);
     if (!is_array($items)) {
         return array();
     }
     $back = array();
     $unique = false;
     foreach ($items as $i => $data) {
         $avail = isset($data[1]) ? $data[1] : 100.0;
         $avail += $rep;
         if (Shadowfunc::dicePercent($avail)) {
             $back[] = $data;
         } else {
             $unique = true;
         }
     }
     if ($unique === true) {
         $player->setTemp($key, $back);
     }
     return $back;
 }
示例#10
0
 public function getStoreItems(SR_Player $player)
 {
     $back = array();
     $rep = $player->get('reputation');
     $back[] = array('Headcomputer');
     $back[] = array('SmartGoggles');
     $back[] = array('Sporn');
     $back[] = array('Cybermuscles');
     $back[] = array('CybermusclesV2');
     $back[] = array('CybermusclesV3');
     $back[] = array('DermalPlates');
     if ($rep >= 1) {
         $back[] = array('DermalPlatesV2');
     }
     if ($rep >= 2) {
         $back[] = array('DermalPlatesV3');
     }
     $back[] = array('WiredReflexes');
     if ($rep >= 2) {
         $back[] = array('WiredReflexesV2');
     }
     if ($rep >= 3) {
         $back[] = array('WiredReflexesV3');
     }
     return $back;
 }
示例#11
0
 public function onSolveCrypto(SR_Player $player, $word, array $args)
 {
     if (count($args) !== 1) {
         $this->rply('crypto1');
         // 			$this->reply('I wrote down some message and cannot decipher it myself again -.- Please tell me the password with #talk crypto <password>.');
         $this->rply('crypto2');
         // 			$this->reply('eht swordsap ot ym fase si ont xenophi tub gimmuhnbrid.');
         $cry = $player->get('crypto');
         if ($cry >= 1) {
             $player->message($this->langNPC('skills1'));
             // 				$player->message('With your awesome crypto skills you can easily read the message: "the password to my safe is not phoenix but hummingbird."');
         } elseif ($cry >= 0) {
             $player->message($this->langNPC('skills2'));
             // 				$player->message('With your awesome crypto skills you immediately recognize it\'s a simple anagram for each word.');
         }
         return true;
     }
     $answer = $args[0];
     switch ($answer) {
         case 'hummingbird':
             return $this->onQuestSolved($player, $word, $args);
         case 'phoenix':
             return $this->rply('almost');
             // 				return $this->reply('Yeah this rings a bell ... Let me try ... Darn wrong!');
         // 				return $this->reply('Yeah this rings a bell ... Let me try ... Darn wrong!');
         default:
             return $this->rply('wrong');
             // 				return $this->reply('Sweet let me try it on my safe ... Darn wrong.');
     }
 }
示例#12
0
 public static function onFight(SR_Player $player, SR_Party $ep)
 {
     $p = $player->getParty();
     $l1 = $player->get('level');
     $add = 0.0;
     foreach ($ep->getMembers() as $e) {
         $e instanceof SR_Player;
         if (!$e->isHuman()) {
             $add += 0.05;
             continue;
         }
         $badkarma = $e->getBase('bad_karma');
         if ($badkarma > 0) {
             continue;
         }
         //			$bounty = $e->getBase('sr4pl_bounty');
         $l2 = $e->get('level');
         $diff = $l1 - $l2;
         if ($diff < 0) {
             continue;
         }
         $add += round($diff / 100, 2);
     }
     self::addBadKarma($player, $add);
 }
示例#13
0
 public function onThrow(SR_Player $player, SR_Player $target)
 {
     $firearms = $player->get('firearms');
     $atk = 20 + $firearms;
     $mindmg = 1;
     $maxdmg = 6;
     $out_dmg = '';
     $out_dmgep = '';
     $out_eff = '';
     $inaccuracy = rand(2, 4) - ($firearms ? 1 : 0);
     $targets = $this->computeDistances($target, $inaccuracy);
     foreach ($targets as $data) {
         list($t, $d) = $data;
         $t instanceof SR_Player;
         $a = $atk - $d + rand(-1, 2);
         $a = Common::clamp($a, 0, $atk);
         $def = $t->get('defense');
         $arm = $t->get('marm');
         $hits = Shadowfunc::diceHits($mindmg, $arm, $atk, $def, $player, $t);
         $hits -= $arm;
         $hits = Common::clamp($hits, 0);
         if ($hits == 0) {
             continue;
         }
         $dmg = round($mindmg + $hits / 10, 2);
         if ($dmg <= 0) {
             continue;
         }
     }
 }
示例#14
0
文件: Soldier.php 项目: sinfocol/gwf3
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $t = 'Redmond_Soldier_Hire';
     $price = 400 - Common::clamp($player->get('negotiation'), 0, 10) * 10;
     $time = 600 * $player->get('charisma') * 60;
     $b = chr(2);
     switch ($word) {
         case 'renraku':
             $msg = "I like their {$b}hardware{$b}, but they have too much influence to the market.";
             break;
         case 'hardware':
             $msg = "Yeah... Hardware and stuff. You don't know Renraku? Are you a crackhead?";
             break;
         case 'shadowrun':
             $msg = "You need to {$b}hire{$b} a runner?";
             break;
         case 'gizmore':
             $msg = "If you are here for a special quest, I can only say I have no idea. Is there a city full of you?";
             break;
         case 'hire':
             if ($player->getTemp($t)) {
                 $msg = "What do you say, chummer?";
             } else {
                 $msg = "I will follow you for a while for... Let's say... {$price} bucks.";
                 $player->setTemp($t, 1);
             }
             break;
         case 'yes':
             if ($player->hasTemp($t)) {
                 $msg = $this->onHire($player, $price, $time);
                 $player->unsetTemp($t);
             } else {
                 $msg = "Yes! Have a seat.";
             }
             break;
         case 'no':
             if ($player->getTemp($t)) {
                 $player->unsetTemp($t);
             }
             $msg = "Then not.";
             break;
         default:
             $msg = "What's up, chummer?";
             break;
     }
     $this->reply($msg);
 }
示例#15
0
 public function calcTicketPrice($price, SR_Player $player)
 {
     $neg = Common::clamp($player->get('negotiation'), 0, 10) * 0.01;
     $mc = $player->getParty()->getMemberCount();
     $price = $price * $mc;
     $price = $price * (1.0 - $neg);
     return $price;
 }
示例#16
0
 public function on_pull(SR_Player $player, array $args)
 {
     if ($player->get('strength') < self::NEED_STR) {
         $player->message($this->lang($player, 'fail'));
     } else {
         $this->onPullSword($player);
     }
 }
示例#17
0
 public static function alchemicFactory(SR_Player $player, $spellname, $level)
 {
     $ma = $player->get('magic');
     $in = $player->get('intelligence');
     $wi = $player->get('wisdom');
     $alc = $player->get('alchemy');
     # 10 - 80 percent randomness
     $randomness = 100 - ($wi + $alc * 2 + $in + $ma);
     $randomness = Common::clamp($randomness, 10, 80);
     $randomness = Shadowfunc::diceFloat(10, $randomness) * 0.01;
     # Dice!
     $minlevel = round($level - $level * $randomness, 1);
     $maxlevel = $level;
     $level = Shadowfunc::diceFloat($minlevel, $maxlevel, 1);
     $potion = SR_Item::createByName('AlchemicPotion');
     $potion->addModifiers(array($spellname => $level, 'magic' => $player->getBase('magic'), 'intelligence' => $player->getBase('intelligence'), 'wisdom' => $player->getBase('wisdom')));
     return $potion;
 }
示例#18
0
文件: blow.php 项目: sinfocol/gwf3
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     $lev = $this->getLevel($player);
     $int = $potion_player->get('intelligence');
     $wis = $potion_player->get('wisdom');
     $min = 0.5;
     $min += $level * 0.2;
     $min += $wis * 0.2;
     $min += $int * 0.1;
     $min += $hits * 0.1;
     $max = $min * 2;
     $metres = Shadowfunc::diceFloat($min, $max, 2);
     $ep = $target->getParty();
     $ep->movePlayer($target, false, $metres);
     $this->announceADV($player, $target, $level, '10020', $metres, $target->getY());
     // 		$append = sprintf('%s got blown away %s metres and is now on position %s.', $target->getName(), $metres, $target->getY());
     // 		$this->announceADV($player, $target, $level, $append);
     return true;
 }
示例#19
0
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $key = 'Seattle_Citizen_Hire_' . $player->getID();
     $key2 = 'Seattle_Citizen_Invite_' . $player->getID();
     $b = chr(2);
     switch ($word) {
         case 'shadowrun':
         case 'no':
             return $this->reply("Yo chummer, you're on a run?");
         case 'hire':
             $ch = $player->get('charisma');
             $re = $player->get('reputation');
             if ($player->getParty()->hasHireling()) {
                 $this->reply('You already have a hireling. So I say no anway.');
             } elseif ($this->hasTemp($key) || rand(0, 32) > $ch + $re) {
                 $this->reply('You don\'t look very skilled. I better follow my own way.');
                 $this->setTemp($key, 1);
             } else {
                 $time = 400 + $ch * 40 + $re * 20;
                 $p = $this->getParty();
                 $p->kickUser($this, true);
                 $this->onHireC($player, $time);
                 $p->popAction(true);
                 $player->getParty()->popAction(true);
                 $this->reply("Ok, let's go!");
             }
             break;
         case 'invite':
             $quest = SR_Quest::getQuest($player, 'Seattle_Barkeeper');
             $quest instanceof Quest_Seattle_Barkeeper;
             $quest->onTryInvite($this, $player);
             break;
         default:
         case 'hello':
             $this->reply("Hello chummer. Are you on a {$b}Shadowrun{$b}?");
             $player->giveKnowledge('words', 'Yes');
             $player->giveKnowledge('words', 'No');
             $player->giveKnowledge('words', 'Shadowrun');
             break;
     }
     return true;
 }
示例#20
0
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $price = 800 - Common::clamp($player->get('negotiation'), 0, 10) * 10;
     $time = 1000 * $player->get('charisma') * 60;
     $b = chr(2);
     switch ($word) {
         case 'shadowrun':
             return $this->reply("I am one of the best runners you can get. Wanna hire?");
         case 'yes':
             return $this->reply("Yes, {$b}hire{$b} me and i'll aid you in combat.");
         case 'no':
             return $this->reply("I am good with magic, but not with reading minds.");
         case 'hire':
             return $this->onHire($player, $price, $time);
         default:
             $msg = "Hello chummer, need a partner?";
             break;
     }
     $this->reply($msg);
 }
示例#21
0
文件: Ether.php 项目: sinfocol/gwf3
 public function onConsume(SR_Player $player)
 {
     $es = $player->get('essence');
     $min = 3 + $es * 2;
     # 15
     $max = $min * 2;
     # 30
     $gain = rand($min, $max);
     $gained = $player->healMP($gain);
     $player->message(sprintf('You gained +%s MP!', $gained));
 }
示例#22
0
文件: flu.php 项目: sinfocol/gwf3
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     $seconds = Common::clamp(90 - $hits, 30, 90);
     $amount = rand($level, $level + $hits / 3) + rand(0, $player->get('wisdom'));
     $per_sec = round($amount / $seconds, 2);
     $per_sec = $this->lowerSpellIncrement($target, $per_sec, 'hp');
     echo "Casting flu with level {$level} and {$hits} hits. The target will loose {$amount} HP within {$seconds} seconds.\n";
     $modifiers = array('hp' => -$per_sec);
     $target->addEffects(new SR_Effect($seconds, $modifiers, SR_Effect::MODE_REPEAT));
     $this->announceADV($player, $target, $level);
     return true;
 }
示例#23
0
文件: freeze.php 项目: sinfocol/gwf3
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     $wis = $potion_player->get('wisdom') * 30;
     $min = 20 + $level * 10;
     $max = 40 + $level * 20 + $wis;
     $seconds = rand($min, $max);
     $seconds = $this->lowerSpellIncrement($target, $seconds, 'frozen');
     $target->busy($seconds * 10);
     $ef = Shadowfunc::diceFloat(0.1, $level, 1);
     $target->addEffects(new SR_Effect($seconds, array('frozen' => $ef), SR_Effect::MODE_ONCE_EXTEND));
     $this->announceADV($player, $target, $level, '10050', $seconds, $ef);
     return true;
 }
示例#24
0
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     $wisdom = $potion_player->get('wisdom');
     $damage = rand($level, $level + $wisdom + 1);
     $this->spellDamageSingleTarget($player, $target, $level, $damage);
     $seconds = Common::clamp(90 - $hits, 30, 90);
     $amount = rand($level * 2, $level * 2 + $hits / 3);
     $per_sec = round($amount / $seconds, 2);
     echo "Casting poison_dart with level {$level} and {$hits} hits. The target will loose {$amount} HP within {$seconds} seconds.\n";
     $modifiers = array('hp' => -$per_sec);
     $target->addEffects(new SR_Effect($seconds, $modifiers, SR_Effect::MODE_REPEAT));
     $this->announceADV($player, $target, $level);
     return true;
 }
示例#25
0
文件: icedorn.php 项目: sinfocol/gwf3
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     $wis = $potion_player->get('wisdom') * 30;
     $min = 5 + $level * 5;
     $max = 10 + $level * 10 + $wis;
     $seconds = rand($min, $max);
     $seconds = $this->lowerSpellIncrement($target, $seconds, 'frozen');
     $target->busy($seconds * 10);
     $ef = Shadowfunc::diceFloat(0.1, $level, 1);
     $target->addEffects(new SR_Effect($seconds, array('frozen' => $ef), SR_Effect::MODE_ONCE_EXTEND));
     $min = 0.5 + $level * 0.3;
     $max = $min + $level * 0.8 + $hits * 0.25;
     $damage = Shadowfunc::diceFloat($min, $max);
     return $this->spellDamageSingleTarget($player, $target, $level, '10040', $damage, $seconds);
 }
示例#26
0
文件: SR_Rune.php 项目: sinfocol/gwf3
 public static function randModifier(SR_Player $player, $level)
 {
     $luck = $player->get('luck');
     $total = 0;
     $possible = array();
     $level = intval($level + $luck * 2);
     foreach (self::getRuneData() as $data) {
         $minlvl = $data[self::RUNE_MIN_LEVEL];
         if ($level < $minlvl) {
             continue;
         }
         $maxlvl = $data[self::RUNE_MAX_LEVEL];
         $range = $maxlvl - $minlvl;
         # Percent of level
         $level = Common::clamp($level, 0, $maxlvl);
         $l = $level - $minlvl;
         $l = $l / $range;
         $dc = round($data[self::RUNE_DROP_CHANCE] * $l * 100);
         if ($dc < 1) {
             continue;
         }
         $possible[] = array($data, $dc);
         $total += $dc;
     }
     if (count($possible) === 0) {
         return false;
     }
     if (false === ($data = Shadowfunc::randomData($possible, $total, 0))) {
         return false;
     }
     $minlvl = $data[self::RUNE_MIN_LEVEL];
     $maxlvl = $data[self::RUNE_MAX_LEVEL];
     $range = $maxlvl - $minlvl;
     $l = $level - $minlvl;
     $l = $l / $range;
     $min = $data[self::RUNE_MIN_MODIFIER];
     $max = $data[self::RUNE_MAX_MODIFIER];
     $r = $max - $min;
     $max = $r * $l;
     $power = Shadowfunc::diceFloat($min, $min + $max, 2) * SR_Player::RUNE_MULTIPLIER;
     if ($power < 0.1) {
         return false;
     }
     //		echo "RUNE POWER $min - $max: $power\n";
     return array($data[self::RUNE_MODIFIER] => $power);
 }
示例#27
0
文件: feel.php 项目: sinfocol/gwf3
 private static function getFeel($field, SR_Player $member, $sign)
 {
     $FAL = false;
     // BG
     $wht = GWF_IRCUtil::WHITE;
     $blk = GWF_IRCUtil::BLACK;
     // FG
     $grn = GWF_IRCUtil::GREEN;
     // 		$lgn = GWF_IRCUtil::LIGHT_GREEN;
     $blk = GWF_IRCUtil::BLACK;
     $ong = GWF_IRCUtil::ORANGE;
     $red = GWF_IRCUtil::RED;
     $bwn = GWF_IRCUtil::BROWN;
     $b = array(1111, $FAL, 1111, $FAL, $FAL, $FAL, 1111, $FAL, 1111, 1111);
     $bg = array($wht, $wht, $wht, $wht, $wht, $wht, $wht, $wht, $wht, $wht);
     $fg = array($red, $red, $ong, $ong, $bwn, $bwn, $blk, $blk, $grn, $grn);
     $feel = min(round(($member->get($field) / 10000 + 1.0) / 3.0 * 10), 9);
     return GWF_IRCUtil::boldcolor($sign . $feel, $b[$feel], $fg[$feel], $bg[$feel]);
 }
示例#28
0
 public function onThrow(SR_Player $player, SR_Player $target)
 {
     $party = $player->getParty();
     $ep = $party->getEnemyParty();
     $mc = $party->getMemberCount();
     $firearms = $player->get('firearms');
     $atk = 15;
     $mindmg = 1;
     $maxdmg = 4;
     $damage = array();
     $inaccuracy = rand(2, 4) - ($firearms ? 1 : 0);
     $targets = self::computeDistances($target, $inaccuracy);
     foreach ($targets as $data) {
         list($pid, $d) = $data;
         $target = $ep->getMemberByPID($pid);
         $target instanceof SR_Player;
         $a = $atk - $d * $d + rand(-1, 2);
         $a = Common::clamp($a, 0, $atk);
         $def = $target->get('defense');
         $arm = $target->get('marm');
         $hits = Shadowfunc::diceHits($mindmg, $arm, $a, $def, $player, $target);
         $hits = Common::clamp($hits, 0);
         echo "Dicing... DIST: {$d}, ATK: {$a}, DEF: {$def}. Hits: {$hits}\n";
         //			$hits -= $arm;
         if ($hits <= 0) {
             continue;
         }
         $dmg = round($mindmg + $hits * 0.1, 2);
         $dmg = Common::clamp($dmg, $mindmg, $maxdmg);
         $dmg -= $arm;
         if ($dmg <= 0) {
             continue;
         }
         echo "Blinding the target with {$hits} hits ...\n";
         for ($i = 0; $i < $hits; $i += 3) {
             $target->addEffects(new SR_Effect($i * 10, array('attack' => -0.15), SR_Effect::MODE_ONCE));
         }
         $damage[$pid] = $dmg;
     }
     Shadowfunc::multiDamage($player, $damage, 'The Flashbang totally missed all targets.');
 }
示例#29
0
文件: calm.php 项目: sinfocol/gwf3
 public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player)
 {
     // 		$wis = $potion_player->get('wisdom');
     // 		$int = $potion_player->get('intelligence');
     // 		$min = $wis * 0.5 + $level * 0.5 + 1; # min hp gain
     // 		$max = $min + $wis * 1.0; # max hp gain
     // 		$amount = Shadowfunc::diceFloat($min, $max, 1); # amount gain
     // 		$seconds = Common::clamp(300-$hits, 30, 300);
     // 		$per_sec = round($amount / $seconds, 2);
     // 		echo "Cast calm with amount=$amount and seconds=$seconds and per_sec=$per_sec\n";
     $wis = $potion_player->get('wisdom');
     $maxhits = 1400;
     $hits = Common::clamp($hits, 1, $maxhits);
     $per_sec = round($hits / $maxhits, 2);
     $per_sec = Common::clamp($per_sec, 0.01, round($level * 0.015 + 0.02, 2));
     $per_sec = $this->lowerSpellIncrement($target, $per_sec, 'hp');
     $minsec = round($wis * 10 + $hits);
     $seconds = rand($minsec, $minsec * 2);
     $target->addEffects(new SR_Effect($seconds, array('hp' => $per_sec), SR_Effect::MODE_REPEAT));
     $this->announceADV($player, $target, $level, '10120', $per_sec, $seconds);
     return true;
 }
示例#30
0
文件: brew.php 项目: sinfocol/gwf3
 public static function execute(SR_Player $player, array $args)
 {
     if (0 > ($alchemy = $player->get('alchemy'))) {
         $player->msg('1047');
         return false;
         // 			return $player->message('You need to learn alchemy first.');
     }
     $wantlevel = true;
     switch (count($args)) {
         case 2:
             $wantlevel = $args[1];
         case 1:
             $spellname = $args[0];
             break;
         default:
             return $player->message(Shadowhelp::getHelp($player, 'brew'));
     }
     $party = $player->getParty();
     if ($party->isFighting()) {
         $player->msg('1036');
         return false;
         // 			return $player->message('You cannot brew potions when fighting.');
     }
     if (!$party->isIdle()) {
         $player->msg('1033');
         return false;
         // 			return $player->message('Your party needs to be idle for brewing potions.');
     }
     $bot = Shadowrap::instance($player);
     if (false === ($spell = $player->getSpell($spellname))) {
         $player->msg('1048');
         return false;
         // 			return $bot->reply('You don\'t have this spell.');
     }
     $spell->setMode(SR_Spell::MODE_BREW);
     $spell->setCaster($player);
     $level = $player->getSpellLevel($spellname);
     if ($wantlevel === true) {
         $wantlevel = $level;
     }
     if ($wantlevel > $level) {
         $player->msg('1049', array($spellname));
         return false;
         // 			return $player->message(sprintf('You don\'t have the %s spell on that high level.', $spellname));
     }
     $level = $wantlevel;
     if (false === ($bottle = $player->getInvItem('WaterBottle'))) {
         $player->msg('1050', array('WaterBottle'));
         return false;
         // 			return $bot->reply('You do not have a WaterBottle.');
     }
     # Enough mandrake?
     $need_mandrake = $spell->getSpellLevel() * $spell->getSpellLevel();
     if (false === ($mandrake = $player->getInvItem('Mandrake'))) {
         $player->msg('1050', array("{$need_mandrake}xMandrake"));
         return false;
     }
     if ($mandrake->getAmount() < $need_mandrake) {
         $player->msg('1050', array("{$need_mandrake}xMandrake"));
         return false;
     }
     # Consume utilities
     if (false === $bottle->useAmount($player, 1)) {
         return $bot->reply('Database error.');
     }
     if (false === $mandrake->useAmount($player, $need_mandrake)) {
         return $bot->reply('Database error.');
     }
     # Brew it
     if (false === $spell->onCast($player, array(), $level)) {
         $player->msg('1051', array($spellname));
         // 			return $bot->reply('Brewing the potion failed and the bottle is lost.');
         return false;
     }
     if (false === ($potion = Item_AlchemicPotion::alchemicFactory($player, $spellname, $level))) {
         $player->message('Database error 5!');
         return false;
     }
     $player->giveItems(array($potion), $player->lang('from_brewing'));
     return;
 }