piranha wrote:Your chance to get a hero doesn't decrease with more gold. A hero will come in level 2 if you can afford it otherwise in level 1.
You should have a better chance of getting hero offers in 0.9 compared to before.
It's as if the game is trying to assign a high level hero AND allies and if you can't afford the whole thing you just get a plain L1 hero.
if (playerGold >= minHeroOffer) // Need at least 400 gold to have a chance for a hero offer
{
// Work out the percentage chance to get a hero based on current number of heroes + player gold etc. Lets say this is somewhere between 10-75% as it was in 0.8. We'll call it heroChance.
heroRoll = rand(0,100) // Roll for the hero
if (heroRoll <= heroChance) // Got a hero
{
heroCost = rand(400, 450) // Base cost is between 400 and 850.
if (heroCost > playerGold) heroCost = playerGold // Since player got a successful roll make sure they can afford that hero
heroLevel = 1
// Now work out extra levels first
heroLevelRoll = rand(0,100)
if (turn >=6 && turn <=12)
{
if (heroRollLevel <= 66) heroLevel = 2
}
if (turn >=13 && turn <=18)
{
heroLevel = 2
if (heroRollLevel <= 33) heroLevel = 3
}
if (turn >=19 && turn <=24)
{
heroLevel = 2
if (heroRollLevel <=25) heroLevel = 3
if (heroRollLevel >25 && heroRollLevel <=50) heroRollLevel =4
}
if (turn >25)
{
heroLevel = 3
if (heroRollLevel <=33) heroLevel = 4
if (heroRollLevel >33 && heroRollLevel <=66) heroRollLevel =5
}
// Now adjust level by player gold to get the max they can afford
for (i=0; i<heroLevel; i++)
{
if (heroCost + i*250 < playerGold)
{
finalHeroLevel = i+1 // For zero based loop
}
}
heroCost = heroCost + finalHeroLevel*250
// Now work out any allies (just using your posted 0.8 code)
$availablegold = playerGold - heroCost;
if ($availablegold > 500)
{
minrand=0;
maxrand=1;
}
if ($availablegold > 1000)
{
$minrand=1;
$maxrand=2;
}
if ($availablegold > 1500)
{
$minrand=1;
$maxrand=3;
}
if ($availablegold > 2000)
{
$minrand=2;
$maxrand=3;
}
if ($availablegold > 2500)
{
$minrand=2;
$maxrand=4;
}
if ($availablegold > 3500)
{
$minrand=3;
$maxrand=4;
}
$maxnumberofallies = rand($minrand,$maxrand);
wizard[0] = rand(200, 400);
medusa[0] = rand(250, 500);
elemental[0] = rand(250, 500);
ghost[0] = rand(250, 500);
demon[0] = rand(600, 900);
devil[0] = rand(550, 950);
archon[0] = rand(700, 1200);
dragon[0] = rand(800, 1250);
wizard[1] = 22;
medusa[1] = 20;
elemental[1] = 24;
ghost[1] = 21;
demon[1] = 25;
devil[1] = 26;
archon[1] = 27;
dragon[1] = 28;
alliearray = array(wizard, medusa, elemental, ghost, demon, devil, archon, dragon);
shuffle(alliearray); // Only one type of allie in the same offer
allyCost = 0
for (i=0;i maxnumberofallies ;i++)
{
// shuffle(alliearray);
newally = alliearray[0];
if (availablegold < newally[0])
{
continue;
}
allycontent[] = newally[1];
availablegold=availablegold-newally[0];
allyCost = allyCost + newally[0];
}
// heroCost is the cost of the leveled hero
// allyCost is the cost of the allies
// finalHeroLevel is the level of the hero
}
$morethanfive = ($numberofheroes - 4);
if($morethanfive < 1) {$morethanfive = 1;}
$newherochance = ($currentgold - ($numberofheroes * $numberofheroes * 100 * $morethanfive)); // Number of heroes squared
if(($currentgold > 400) && ($newherochance < 500)) {$newherochance = 500;} // Always a **% chance - assuming enough gold
if(($newherochance > 1250) && ($numberofheroes > 0)) {$newherochance = 1250;} // Maximum **% chance if 1+ heroes
//hero cost
$hero = rand(400, 850);
if(rand(350,950) < $newherochance && $currentgold > $hero)
Users browsing this forum: No registered users and 1 guest