Barriers

From TheReincarnation
Revision as of 06:19, 30 January 2017 by Meavic (talk | contribs) (Undo revision 49289 by Tempusfugit (talk))
Jump to: navigation, search

Magical barriers block enemy's spells and items to your country. Requiring certain formula and technique, only an Archmage can build a barrier. There's no way to order anything when you are concentrating to build them. Higher rate of barriers will increase the chance of protecting yourself from various kind of magical attacks.

Effects

  • The percentage of barriers on your land determines overall spell resistance
    • Building ~2.5% barriers gives the maximum 75% barrier resistance
    • The skill Barrier Proficiency can raise maximum resistance to 83%.
  • Barriers require 30 m.p./turn upkeep (60mp/turn on Lightning)
  • Barriers provide no space for population, vs 10 for wilderness.

Building barriers

  • The number of Workshops does not increase the building rate for barriers (these are magical buildings, only the mage can make them)
    • Neither does the Engineer (these are magical buildings, only the mage can make them)
  • If you build 50 barriers at once you will
    • first pay the building cost 50 barriers times 50 m.p. = 2500 m.p.
    • but also pay the upkeep for 50 barriers times 30 m.p. for 50 turns at a cost of 75,000 mana in upkeep alone.
  • Building them one turn at a time saves you ~37,500 mana on upkeep mana.
    • of course the faster you move, the less you risk being attacked while building barriers...

Program Code of Barriers

Source: [1]

sub spell_resisted {

my $caster_mage = shift;
my $target_mage = shift;
my $spell_color = shift;
my $barrier_resistance = $target_mage->getBarrierResistance() / 100;
my $sl_resistance = 0;
my $barrier_piercing = $caster_mage->{mage_spellpiercing} / 100;
my $color_resistance = 0;
$color_resistance = $target_mage->getResistanceNether() if $spell_color eq 'NETHER';
$color_resistance = $target_mage->getResistancePhantasm() if $spell_color eq 'PHANTASM';
$color_resistance = $target_mage->getResistanceAscendant() if $spell_color eq 'ASCENDANT';
$color_resistance = $target_mage->getResistanceVerdant() if $spell_color eq 'VERDANT';
$color_resistance = $target_mage->getResistanceEradication() if $spell_color eq 'ERADICATION';
$color_resistance = 75 if $color_resistance > 75;
#Spell Penetration also reduces color resistance
$color_resistance -= $caster_mage->{mage_spellpiercing};
$color_resistance = 0 if $color_resistance < 0;
$color_resistance /= 100;
#check barriers
if ( rand() < ($barrier_resistance + $sl_resistance - $barrier_piercing)) {
return 0;
}
#check resistances
if (rand() < $color_resistance) {
return 1;
}
#not blocked
return 2;

}