Creation: | ";
- foreach my $created_by_unit_tmp ( @{$created_by_unit{ $u }} ) {
-
- my ( $created_by_u, $method, $discount ) = split(/:/, $created_by_unit_tmp );
-
- print "$u created by unit: $created_by_u method: $method\n";
-
-
- if ( $method eq "morph" ) {
- $full .= "Morphing from ".&link_unit($faction, ${created_by_u})." \n";
- }
- elsif ( $method eq "produce" ) {
- $full .= "Produced by ".&link_unit($faction, ${created_by_u})." \n";
- }
- elsif ( $method eq "build" ) {
- $full .= "Built by ".&link_unit($faction, ${created_by_u})." \n";
- }
- elsif ( $method eq "upgrade" ) {
- $full .= "Upgraded by ".&link_unit($faction, ${created_by_u})." \n";
- }
- }
- $full .= " |
\n";
-
# put cost together
my $full_tmp_cost;
@@ -642,35 +676,58 @@ foreach my $faction_path ( @factions ) {
# loop over creation-methods because f.e. guard might be produced in barracks or upgraded from swordman
my $num_creation_methods =@{$created_by_unit{ $u }};
+ my $num_method=0;
+ $full .= "Creation: | ";
foreach my $created_by_unit_tmp ( @{$created_by_unit{ $u }} ) {
+ $num_method++;
+
my ( $created_by_u, $method, $discount ) = split(/:/, $created_by_unit_tmp );
my ( $cost_tmp, $cost_icon_tmp, $cost_icon_overview_tmp ) = &calc_cost_of_unit( $u, $created_by_u, $method, $discount );
$cost_icon .= $cost_icon_tmp;
+ my %cost_hash;
+ my ( @cost_resources ) = split(/,/, $cost_tmp );
+ foreach my $cost_res ( @cost_resources ) {
+ my ( $resource, $amount ) = split(/:/, $cost_res );
+ $col{"${resource}_${num_method}"} = $amount;
+ $cost_hash{ $resource } = $amount;
+ }
+
+
+ my $created;
+ if ( $method eq "morph" ) {
+ $created = "upgraded from";
+ $full .= "Morphing from ".&link_unit($faction, ${created_by_u})." \n";
+ $col{"creation_${num_method}"} = "Morphed from ".&link_unit( $faction, ${created_by_u});
+ }
+ elsif ( $method eq "produce" ) {
+ $created = "produced by";
+ $full .= "Produced by ".&link_unit($faction, ${created_by_u})." \n";
+ $col{"creation_${num_method}"} = "Produced by ".&link_unit( $faction, ${created_by_u});
+ }
+ elsif ( $method eq "build" ) {
+ $created = "built by";
+ $full .= "Built by ".&link_unit($faction, ${created_by_u})." \n";
+ $col{"creation_${num_method}"} = "Built by ".&link_unit( $faction, ${created_by_u});
+ }
+ elsif ( $method eq "upgrade" ) {
+ $created = "upgraded by";
+ $full .= "Upgraded by ".&link_unit($faction, ${created_by_u})." \n";
+ $col{"creation_${num_method}"} = "Upgraded by ".&link_unit( $faction, ${created_by_u});
+ }
+ else {
+ print "method: $method for $u $created_by_u\n";
+ }
+
+
if ( $num_creation_methods == 1 ) {
$full_tmp_cost .= " |
foreach my $c ( @{$commands_of_unit{"$u:attack"}} ) {
@@ -778,6 +847,8 @@ foreach my $faction_path ( @factions ) {
my $command_pretty = &format_name( $command );
$commands .= "$command_pretty, ";
+ $num_move_command++;
+
my $full_attack_tmp_tmp;
@@ -786,16 +857,41 @@ foreach my $faction_path ( @factions ) {
$full_attack_tmp .= $full_attack_tmp_tmp;
+ my $move_skill = $move_skill{ $c };
+ if ( $move_skill) {
+ my $ms = "$faction:$unit:$move_skill";
+ $col{"move_speed_${num_move_command}"} = $speed{ $ms };
+ }
}
+ $col{"max_move_speed"} = $max_move_speed;
+
# show levels
if ( defined @{ $u_levels{ $u }} ) {
+
+ my $level_num = 0;
+
$full_attack_tmp .= "Level(s): | \n";
+
+
foreach my $level ( @{ $u_levels{ $u }} ) {
+ $level_num++;
+ $col{"max_level"} = $level_num;
+
my ( $name, $kills ) = split(/:/, $level );
- $full_attack_tmp .= &format_name($name)." at $kills kills (HP +50%, EP +50%, Sight +20%, Armor +50%) \n";
+ $full_attack_tmp .= "".&format_name($name)." at $kills kills \n";
+
+ # let do some mathz:
+ $full_attack_tmp .= "Hitpoints: ".int( $max_hp{ $u } * $level_hp ** ( $level_num - 1))." -> ". int( $max_hp{ $u } * ( $level_hp ** $level_num) )." \n";
+
+ if ( $max_ep{ $u } ) {
+ $full_attack_tmp .= "Energy Points: ".int( $max_ep{ $u } * $level_ep ** ( $level_num -1))." -> ".int( $max_ep{ $u } * $level_ep ** $level_num)." \n";
+ }
+
+ $full_attack_tmp .= "Armor Strength: ".int($armor{ $u } * $level_armor ** ($level_num-1))." -> ".int( $armor{ $u } * $level_armor ** $level_num )." \n";
+ $full_attack_tmp .= "Sight: ".int($sight{ $u } * $level_sight ** ( $level_num -1))." -> ".int( $sight{ $u } * $level_sight ** $level_num )." \n";
# as specified in the code, thanks titi for digging it out
#maxHp+= ut->getMaxHp()*50/100;
@@ -806,7 +902,6 @@ foreach my $faction_path ( @factions ) {
$full_attack_tmp .= " |
\n";
}
-
# show available upgrades for this unit
if ( defined @{ $upgrades_for{ $u }} ) {
@@ -814,14 +909,25 @@ foreach my $faction_path ( @factions ) {
foreach my $upgrade_tmp ( @{ $upgrades_for{ $u }} ) {
my ( $u_faction, $u_upgrade ) = split(/:/, $upgrade_tmp );
- $full_attack_tmp .= &link_unit($faction, $u_upgrade)."
\n";
+
+ my ( $upgrade_benefits, $upgrade_benefits_html ) = &do_upgrade_benefits( $upgrade_tmp );
+
+ my $str_tmp = &link_unit($faction, $u_upgrade);
+ $str_tmp .= " ($upgrade_benefits)" if ( $upgrade_benefits );
+ $str_tmp .= "
\n";
+ $full_attack_tmp .= $str_tmp;
+ $col{"available_upgrades"} .= $str_tmp;
+
+
}
$full_attack_tmp .= "\n";
}
# morphing
+ my $num_morph_skill=0;
foreach my $c ( @{$commands_of_unit{"$u:morph"}} ) {
+
my ( $faction, $unit, $command ) = split(/:/, $c );
my $skill = $morph_skill{ $c };
@@ -842,6 +948,12 @@ foreach my $faction_path ( @factions ) {
$full_morph_tmp .= "Morphing to: ".&link_unit($faction, $morph_unit{ $c }).&html_icon($faction.":".$morph_unit{ $c }, 64)."
\n";
$full_morph_tmp .= "Refund (Discount): ".$morph_discount{ $c }." %
\n";
$full_morph_tmp .="Morph Speed: ".$speed{ $s }."
\n";
+
+ $num_morph_skill++;
+ $col{"morphing_to_$num_morph_skill"} = &link_unit($faction, $morph_unit{ $c });
+ $col{"morphing_discount_$num_morph_skill"} = $morph_discount{ $c }." %
\n";
+ $col{"morphing_speed_$num_morph_skill"} = $speed{ $s }."
\n";
+
}
}
$full_morph_tmp .= "\n";
@@ -849,7 +961,9 @@ foreach my $faction_path ( @factions ) {
}
# repairing
+ my $num_heal=0;
foreach my $c ( @{$commands_of_unit{"$u:repair"}} ) {
+ $num_heal++;
my ( $faction, $unit, $command ) = split(/:/, $c );
my $skill = $repair_skill{ $c };
@@ -859,21 +973,28 @@ foreach my $faction_path ( @factions ) {
print "repair_command: $command $c\n";
$full_repair_tmp .= " Repair/Heal Skill: ".&format_name($skill_short)." | ".&format_name($skill_short)."ing: ";
+ $col{"heal_skill_$num_heal"} = &format_name($skill_short);
foreach my $uu ( @{$c_repaired_units{$c}} ) {
$full_repair_tmp .= &link_unit($faction, $uu).", ";
+ $col{"heal_units_$num_heal"} .= &link_unit($faction, $uu).", ";
}
chop $full_repair_tmp;
chop $full_repair_tmp;
+ chop $col{"heal_units_$num_heal"};
+ chop $col{"heal_units_$num_heal"};
$full_repair_tmp .=" \n";
$full_repair_tmp .="Repair/Heal Speed: ".$speed{ $s }." \n";
$full_repair_tmp .= " |
\n";
+ $col{"heal_speed_$num_heal"} = $speed{ $s };
}
# harvesting/mining
+ my $num_mine=0;
foreach my $c ( @{$commands_of_unit{"$u:harvest"}} ) {
+ $num_mine++;
my ( $faction, $unit, $command ) = split(/:/, $c );
my $skill = $harvest_skill{ $c };
@@ -883,10 +1004,15 @@ foreach my $faction_path ( @factions ) {
print "harvest_command: $command $c\n";
$full_harvest_tmp .= " Harvest/Mine Skill: ".&format_name($skill_short)." | ";
+ $col{"mine_speed_$num_heal"} = $speed{ $s };
+ $col{"mine_resource_$num_mine"} = "";
foreach my $resource ( @{$c_harvested_resources{$c}} ) {
$full_harvest_tmp .= &html_icon_resource( $resource, 32 );
+ $col{"mine_resource_$num_mine"} .= &format_name( $resource ).", ";
}
+ chop $col{"mine_resource_$num_mine"};
+ chop $col{"mine_resource_$num_mine"};
$full_harvest_tmp .=" \n";
@@ -895,6 +1021,9 @@ foreach my $faction_path ( @factions ) {
$full_harvest_tmp .="Hits per Unit: ".$hits_per_unit{ $c }." \n";
$full_harvest_tmp .= " |
\n";
+ $col{"mine_speed_$num_mine"} = $speed{ $s };
+ $col{"mine_max_load_$num_mine"} = $max_load{ $c };
+ $col{"mine_hits_per_unit_$num_mine"} = $hits_per_unit{ $c };
}
@@ -916,11 +1045,14 @@ foreach my $faction_path ( @factions ) {
$full .= "Storage: | $storage_icon\n";
if ( $storage =~ /wood/i && $storage !~ /gold/i ) {
- $full .= "(Hint: This also means a worker can drop all of his harvested wood into this building so it's useful to build it near trees.)";
+ $full .= "(Hint: This also means a worker can drop of his harvested wood into this building so it's useful to build it near trees.)";
+
}
$full .= " |
\n";
}
+ $full .= "Production Time: | ".$time{$u}." |
\n";
+ $col{"production_time"} = $time{$u};
if ( !$upgrade{$u} ) {
# OVERVIEW
@@ -938,47 +1070,54 @@ foreach my $faction_path ( @factions ) {
$full .= "Armor-Type: | ".&link_attack_and_armor_types($armor_type{$u})." |
\n";
$full .= "Sight-Range: | ".($sight{$u} || "-")." |
\n";
+ $col{"max_hp"} = $max_hp{$u};
+ $col{"regeneration"} = $regeneration{$u};
+ $col{"max_ep"} = $max_ep{$u} if ( $max_ep{$u});
+ $col{"regeneration_ep"} = $regeneration_ep{$u} if ( $regeneration_ep{$u});
+ $col{"armor"} = $armor{$u};
+ $col{"armor_type"} = &link_attack_and_armor_types($armor_type{$u});
+ $col{"sight"} = $sight{$u};
+
}
else {
# handle upgrades
print "handling upgrade $u - $production_speed{$u} - $armor{$u}\n";
- my $upgrade_benefits="";
- $upgrade_benefits .= "Increase Hitpoints: | +".$max_hp{$u}." |
\n" if ( $max_hp{$u} );
- $upgrade_benefits .= "Increase Energy-Points: | +".$max_ep{$u}." |
\n" if ( $max_ep{$u} );
- $upgrade_benefits .= "Increase Sight Range: | +".$sight{$u}." |
\n" if ( $sight{$u} );
- $upgrade_benefits .= "Increase Attack Strength: | +".$attack_strenght{$u}." |
\n" if ( $attack_strenght{$u} );
- $upgrade_benefits .= "Increase Attack Range: | +".$attack_range{$u}." |
\n" if ( $attack_range{$u} );
- $upgrade_benefits .= "Increase Armor Strength: | +".$armor{$u}." |
\n" if ( $armor{$u} );
- $upgrade_benefits .= "Increase Move Speed: | +".$move_speed{$u}." |
\n" if ( $move_speed{$u} );
- $upgrade_benefits .= "Increase Production Speed: | +".$production_speed{$u}." |
\n" if ( $production_speed{$u} );
+ # do Increases:
+ my ( $upgrade_benefits, $upgrade_benefits_html ) = &do_upgrade_benefits( $u );
+
+ $full .= $upgrade_benefits_html;
+
+
- $full .= $upgrade_benefits;
- $upgrade_benefits =~ s/<\/?TR>//gi;
- $upgrade_benefits =~ s/<\/?TD>//gi;
- $upgrade_benefits =~ s/Increase //gi;
$overview_tmp .= " ".$upgrade_benefits;
$overview_tmp .= " | ";
+ $col{"upgrade_affects"} ="";
+
my $units="";
foreach my $unit_tmp ( @{$upgrade_effects{$u}} ) {
$units .= &link_unit($faction, $unit_tmp).", ";
+ $col{"upgrade_affects"} .= &link_unit($faction, $unit_tmp).", ";
}
chop ($units);
chop ($units);
+ chop $col{"upgrade_affects"};
+ chop $col{"upgrade_affects"};
$overview_tmp .= ($units || "")."\n";
$full .= " | Affects Units: | ".($units || "")." |
\n" if ( $units );
}
+ # handle requirements. this won't go into $col for the all-table because that's not usefull in a 2D-sheet
my $req_overview_tmp;
for my $relation ('Build', 'Produce', 'Upgrade', 'Requirement', 'Upgrade-Requirement', 'Command' ) {
$found = 0;
if ( $relation =~ /Require/i ) {
- $full_tmp = "$unit_pretty is an $relation for: | ";
+ $full_tmp = " |
$unit_pretty is a $relation for: | ";
}
elsif ( $relation =~ /Command/i ) {
$full_tmp = " |
$unit_pretty enables commands: | ";
@@ -1054,6 +1193,7 @@ foreach my $faction_path ( @factions ) {
$overview_worker .= " | ".($max_move_speed || "--" )." | \n";
my ( $o_tmp, $f_tmp ) = &do_air_ground( $u );
$overview_worker .= $o_tmp;
+ $col{"air_ground"} = $o_tmp;
$full .= $f_tmp;
}
@@ -1064,7 +1204,13 @@ foreach my $faction_path ( @factions ) {
$overview_combat .= "".($max_move_speed || "--" )."\n";
my ( $o_tmp, $f_tmp ) = &do_air_ground( $u );
$overview_combat .= $o_tmp;
- $full .= $f_tmp;
+ $col{"air_ground"} = $o_tmp;
+
+ # avoid writting the movement-type twice into technician (worker+combat unit)
+ if ( !$worker{$u} ) {
+ $full .= $f_tmp;
+ }
+
$overview_combat .= " | ";
@@ -1073,6 +1219,9 @@ foreach my $faction_path ( @factions ) {
# average to tell that 200-400 is stronger than 50-450)
$overview_combat .= "$max_strength_vs_land +- $max_strength_vs_land_var";
+ $col{"max_strength_vs_land"} = $max_strength_vs_land;
+ $col{"max_strength_vs_land_var"} = $max_strength_vs_land_var;
+
# next line is showing damage as range, e.g. 150-450
#$overview_combat .= ($max_strength_vs_land - $max_strength_vs_land_var )."-".($max_strength_vs_land + $max_strength_vs_land_var );
}
@@ -1085,6 +1234,9 @@ foreach my $faction_path ( @factions ) {
if ($max_strength_vs_air ) {
$overview_combat .= "$max_strength_vs_air +- $max_strength_vs_air_var";
#$overview_combat .= ($max_strength_vs_air - $max_strength_vs_air_var )."-".($max_strength_vs_air + $max_strength_vs_air_var );
+
+ $col{"max_strength_vs_air"} = $max_strength_vs_air;
+ $col{"max_strength_vs_air_var"} = $max_strength_vs_air_var;
}
else {
$overview_combat .= "--\n";
@@ -1092,6 +1244,7 @@ foreach my $faction_path ( @factions ) {
$overview_combat .= " | ";
$overview_combat .= "".($max_range || "--" )." | \n";
+ $col{"max_range"} = $max_range;
}
$full .= $full_move_tmp;
@@ -1115,6 +1268,19 @@ foreach my $faction_path ( @factions ) {
print UNIT $footer;
close UNIT;
+ # do all all everything table
+ $all_html_table .= "
\n";
+ foreach my $co ( @col_order ) {
+
+ # align everything centered except numbers
+ my $align ="CENTER";
+ if ( $col{"$co"} && $col{"$co"} =~ /^\d+$/ ) {
+ $align="RIGHT";
+ }
+ $all_html_table .= " ".($col{"$co"} || "")." | \n";
+
+ }
+ $all_html_table .= "
\n";
}
$overview_combat .= "