Напишано од YOBA, 20.09.2011 at 15:25
This is my dream.
Please make it come true. ;__;
Also, please introduce automatic hyperlinks in the chat. That would be quite nice.
Finally, I think you should release the formulae used to determine attack strength and what-not. No offence, but I don't think they are unique enough that a competitor (there is none actually!) would nick them off you. This way the more mathematically-oriented members can take a look and help in balancing. No source code, don't worry! Just the formulae.
The clock would look nicer, I guess, but I'm not sure it's worth embedding a new font just for it.
Links in the chat, written down for the to-do list.
As for the formulae, the entire thing is several pages long and I can't be bothered to edit it into something coherent. This is the main part, see if you can make any sense of it:
Наводници:
// randomly selecting the defending army
Troop defendingArmy = enemies[model.Random.Next(0, enemies.Count)];
bool inOwnCity = InCity != null && defendingArmy.InCity == InCity;
bool inDefenceLine = DefenceLineOwner == defendingArmy.Owner;
// selecting the defending unit (unit with the highest max attack)
Unit defendingUnit = null;
foreach (Unit unit in defendingArmy.Units.Values)
{
if (unit.UnitType == UnitType.Land && (defendingArmy == Defender && defendingArmy.IsTransportIntercepted || !battleIsOverland && initCanMoveOnWater[defendingArmy.Owner.Id])) continue;
if (defendingUnit == null ||
unit.MaxDefence + unit.GetDefenceBonus(inOwnCity, inDefenceLine, attackingUnit) > defendingUnit.MaxDefence + defendingUnit.GetDefenceBonus(inOwnCity, inDefenceLine, attackingUnit))
defendingUnit = unit;
}
int defenceBonus = defendingUnit.GetDefenceBonus(inOwnCity, inDefenceLine, attackingUnit);
game.Logger.Debug("Defending unit: {0} (in own city - {1}, in defence line - {2})", defendingUnit.ToString(), inOwnCity, inDefenceLine);
// difference ratio between the attacker's and defender's combined initial strength
double attackDefenceDiff = (double)(initTotalMaxAttack[attackingArmy.Owner.Id] + initTotalUnitCount[attackingArmy.Owner.Id]) /
(initTotalMaxDefence[defendingArmy.Owner.Id] + initTotalUnitCount[defendingArmy.Owner.Id] + initUnitCount[defendingArmy.Owner.Id][defendingUnit.Id] * defenceBonus);
// calculating random multipliers
double minMultiplier = 0.5; // minimum cascading random multiplier (max = 0.99)
double multiplier = 0;
if (attackDefenceDiff > 1)
multiplier = (1 - minMultiplier) / attackDefenceDiff + minMultiplier;
else
multiplier = (1 - minMultiplier) / (1 / attackDefenceDiff) + minMultiplier;
double attackMultiplier = attackDefenceDiff >= 1 ? 1 : multiplier;
double defenceMultiplier = attackDefenceDiff <= 1 ? 1 : multiplier;
// rolls
int maxAttack = attackingUnit.MaxAttack;
if (maxAttack < 1) maxAttack = 1;
int attackRoll = Utils.CascadingRandom(model.Random, 1, maxAttack, attackMultiplier);
if (maxAttack > 15 && attackRoll < maxAttack / 2)
attackRoll = maxAttack / 2;
int maxDefence = defendingUnit.MaxDefence + defenceBonus;
if (maxDefence < 1) maxDefence = 1;
int defenceRoll = Utils.CascadingRandom(model.Random, 1, maxDefence, defenceMultiplier);
if (maxDefence > 15 && defenceRoll < maxDefence / 2)
defenceRoll = maxDefence / 2;
// after roll bonuses
double arbMultiplier = 0.66; // arb cascading random multiplier
int arbChance = 25;
// attack ARB
int attackARB = 0;
if (attackingUnit.ARB > 0)
{
if (Utils.ChanceRandom(model.Random, arbChance))
attackARB = Utils.CascadingRandom(model.Random, 1, attackingUnit.ARB, arbMultiplier); // multiplier = 0.66
}
// defence ARB
int defenceARB = 0;
if (defendingUnit.ARB > 0)
{
if (Utils.ChanceRandom(model.Random, arbChance))
defenceARB = Utils.CascadingRandom(model.Random, 1, defendingUnit.ARB, arbMultiplier); // multiplier = 0.66
}
// damage
// int damage = (attackRoll + attackARB) - (defenceRoll + defenceARB);
int attackDamage = attackRoll + attackARB;
int defenceDamage = defenceRoll + defenceARB;