new file: cell2loc.py
[GalaxyCodeBases.git] / perl / etc / ma.pl
blob68e55bf12e3f0a1492470d30a64a553fd74c64c6
1 #!/bin/env perl
2 use strict;
3 use warnings;
5 die "Usage: $0 boss_atk boss_hp [my_hp] [my_atk]\n" if @ARGV < 2;
6 my ($batk,$bhp,$myhp,$myatk)=@ARGV;
7 my $tmp='';
8 $tmp .= ", MyHP:$myhp" if $myhp;
9 $tmp .= ", MyATK:$myatk" if $myatk;
10 print "Input: BossATK:$batk, BossHP:$bhp$tmp\n";
12 my $MaxHP = 200000;
13 my $MaxATK = 300000;
15 my $Times = int(1+ $MaxHP / $batk);
16 for my $times ( 1 .. $Times) {
17 my $needATK = int(1+ $bhp / $times);
18 my $minHP = $batk * $times;
19 next if $needATK > $MaxATK;
20 last if $myhp and 3*$myhp < $minHP;
21 my $tmp='';
22 if ($times>1 and $myhp and $myhp > $minHP) {
23 my $maxBossATK = int($myhp/$times);
24 $tmp .= "\tMaxBossATK: $maxBossATK";
26 if ($myatk) {
27 my $maxBossHP = 2*$myatk*$times;
28 $tmp .= "\tMaxBossHP: $maxBossHP (2x)";
30 print "Times: $times\tHP: $minHP\tAtk: ".int(1+$needATK/3),"(x3) ",int(1+$needATK/2),"(x2) $needATK(x1)$tmp\n";
33 print "$Times\n";
34 __END__
35 MaxHP=154060
36 MaxATK=167033