function theanalprobe($you, $me, $probes, $shield, $friendly) { global $config,$global; if (isblacklisted($me['id'], $you['id'])) return "Cheating protection: You may not interact with this kingdom."; if (!setprobelock(1)) return "Cheating protection: Unable to initialize instantaneous probings on the same ID."; $me = loaduser($me['id']); $you = loaduser($you['id']); $my_ratio = $me['probes']/$me['land']; $your_ratio = $you['probes']/$you['land']; if ($you['shield_probe'] > 0) { $freepower = $you['power']; foreach($global[shields] as $shield => $purty) $freepower -= $you['shield_probe']; $max = @floor($you['land']/$config['shield_probe_numeric']); $yourshields = @floor(($you['shield_probe']/$max)*100); if ($yourshields > $config['shield_probe_maximum']) $yourshields = $config['shield_probe_maximum']; if ($freepower < 1) $yourshields = 0; if ($you[state] == 4) $yourshields = $config['shield_probe_maximum']; if ($yourshields > 0) $your_ratio *= 1+($yourshields/100); } if ($shield == "on") if ($me['power'] >= ($probes*$config['probe_shield_energy_requirement'])) { $my_ratio *= $config['probe_shield_numeric']; $me['power'] -= ($probes*$config['probe_shield_energy_requirement']); $saves .= "power "; } if ($my_ratio > $your_ratio) $numeric = 4; else $numeric = 8; $percentage = ($probes/($you[land]*$numeric))*100; if ($percentage < 10) $percentage = 10; if ($me['edict_probe'] > time() && $friendly === 1) $percentage += $config['edict_probe_chance']; if ($me['research_armour'] >= $config['research_points_armour']) $config['probeloss_loss_numeric'] *= $config['probearmour_numeric']; if (rand(1,100) <= $percentage) { $me['probes'] -= $probes*$config['probeloss_success_numeric']; $probe = true; $losses += $probes*$config['probeloss_success_numeric']; } else { $me['probes'] -= $probes*$config['probeloss_loss_numeric']; $probe = false; $losses += $probes*$config['probeloss_loss_numeric']; } if ($you['research_fdc'] >= $config['research_points_fdc'] && rand(1,4) == 4) $fdc = true; else $fdc = false; if ($me[state] == 2 && $me[probeattempts] > $config['state_2_probeattempts']) $me['probeattempts'] = $config['state_2_probeattempts']; $me['probeattempts'] -= 1; $you['newnews'] += 1; $you['lastnews'] = time(); $saves .= "probes probeattempts newnews lastnews"; saveuserdata($me, $saves); saveuserdata($you, $saves); $users = $me; if ($percentage <= 100) $accuracy = 1; else $accuracy = (rand(95,99)/100); setprobelock(0); return array($probe, $accuracy, $fdc, $losses, $you, $me); }