Scouting spell, number crunching

Ask for help or introduce yourself to the community here. This is also an academy for new players/members.
Post Reply
User avatar
Drahken
Advanced Member
Posts: 62
Joined: Wed Sep 14, 2005 3:29 pm

Post by Drahken »

1) How does the scout spell decide how much land to give you? Is it based on a percentage of your current land? If so, what percentage? Is it a straight percentage or is there also a random factor involved.
2) After you cast the spell it claims that you lost some food/cash/hawks in the process. On this server, I don't see any loss. On the crazybri server, I see about 10k loss in food/cash (my account there is about twice the size of my account here, don't know if that makes a diff). How much cash/food/hawks are you supposed to lose per spell casting?
User avatar
Slasher
The FAF Forums SMEGHEAD!!! lol
Posts: 2635
Joined: Mon May 03, 2004 5:08 pm
Location: http://florida4us.com/
Contact:

Post by Slasher »

The loss depends on your current net I think I woul dhave to check the source code for that which I cant be bothered to do at the moment as I am at college *laughs*. As for how much land it gives you that is probably something to do with the amount of hawks, networth and runes you have at the time of hawk scouting.
I do not have a signature, you must be imagining

http://florida4us.com/

Image
User avatar
Drahken
Advanced Member
Posts: 62
Joined: Wed Sep 14, 2005 3:29 pm

Post by Drahken »

I'd appreciate it if you (or someone else) could look at the code and find the answers when you get the chance. I don't know jack about programming, so I can't do it myself. Thanks.


Well, I've found some of the answers by experimenting. There's no random factor, and land gain appears to be .2% of your current land.
User avatar
Drahken
Advanced Member
Posts: 62
Joined: Wed Sep 14, 2005 3:29 pm

Post by Drahken »

Anyone have any formulas for the loot and forage spells?
User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

http://faf.staronesw.com/?source&script=spells

CashProduced:
Hawks * PercentHealth * 65 * (1 + Huts / Land) * RaceBonus / SizeBonus^2

FoodProduced:
CashProduced / (3 * FoodWorth)

SizeBonus:

code: Select all

function calcSizeBonus ($networth)
{
    if ($networth <= 100000)
        $size = 0.524;
    elseif ($networth <= 500000)
        $size = 0.887;
    elseif ($networth <= 1000000)
        $size = 1.145;
    elseif ($networth <= 10000000)
        $size = 1.294;
    elseif ($networth <= 100000000)
        $size = 1.454;
    else $size = 1.674;
    return $size;
}
:wq
User avatar
Drahken
Advanced Member
Posts: 62
Joined: Wed Sep 14, 2005 3:29 pm

Post by Drahken »

This looks like thecode for the scout spell, but I can't decipher it:

code: Select all

function missionED ()
{
    global $users, $urace, $lratio, $config, $produced;
    global $spratio, $mission_num;
    $edcap = 500;
    if ($lratio >= $spratio[$mission_num])
    {
        $randland = round(mt_rand(0,round($users[land] * .02 + 1)));
        if ($randland < ($users[land] * .03)) { $randland = round($users[land] * .03); }
        if ($randland > ($users[land] * .06)) { $randland = round($users[land] * .06); }

        $newland=0.1*$randland;
        if ($newland > $edcap) {$newland=$edcap;}
        if ($newland < 0) {$newland=$edcap;}
        $mageloss= (100-($newland/250))/100;
        if ($mageloss < .94) {$mageloss=.94;}
        $foodloss= (100-($newland/150))/100;
        if ($foodloss < .92) {$foodloss=.92;}
        $cashloss= (100-($newland/750))/100;
        if ($cashloss < .95) {$cashloss=.95;}

        $newland = $newland*$users[health]/100;
        if ($newland > $edcap) {$newland=$edcap;}
        if ($newland < 0) {$newland=$edcap;}

        $land = $newland;
        $produced += $land;

        $users[land] = $users[land] + $land;
        $users[freeland] = $users[freeland] + $land;
        $users[food]=round($users[food]*$foodloss);
        $users[cash]=round($users[cash]*$cashloss);

        $cashloss = round($cashloss);
        $foodloss = round($foodloss);
        $mageloss = round($mageloss);
        $cashloss = commas($cashloss);
        $foodloss = commas($foodloss);
        $mageloss = commas($mageloss);

        saveUserDataNet($users,"health land freeland cash food wizards");
    }
    else    missionFail();
}

User avatar
The Beatles
Fear me for I am root
Posts: 6285
Joined: Tue May 24, 2005 8:12 pm

Post by The Beatles »

$edcap = 500;

AddLand = RandomVariableBetween(0, Land * 0.02 + 1)
If AddLand is less than Land * 0.03, then AddLand = Land * 0.03.
If AddLand is greater than Land * 0.06, then AddLand = Land * 0.06.

NewLand = 0.1 * AddLand
If NewLand is greater than 500 or less than 0, then NewLand = 500.

MageLoss = (100 - (NewLand/250)) / 100
If MageLoss is less than 0.94, then MageLoss = 0.94

FoodLoss = (100 - (NewLand/150)) / 100
If FoodLoss is less than 0.92, then FoodLoss = 0.92

CashLoss = (100 - (NewLand/750)) / 100
If CashLoss is less than 0.95, then CashLoss = 0.95

NewLand = NewLand * PercentHealth

Land = Land + NewLand
Food = Food * FoodLoss
Cash = Cash * CashLoss

Wizards appear never to be lost. This Is A Bug.
:wq
Tarislarech
Advanced Member
Posts: 35
Joined: Fri Jan 13, 2006 12:06 pm

Post by Tarislarech »

Is there anyway we could get a calculater for scouting land. Any good programmers out there?
Image
Post Reply
  • Members connected in real time

    🔒 Close the panel of connected members