Mercurial > eagle-eye
comparison Ikariam.pm @ 86:a8acf50bf7bb
implemented a simple MilityExpenditure counting
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 26 Oct 2008 14:30:58 +0800 |
parents | 2c6c219dc3ff |
children | 4c82cf844aa8 |
comparison
equal
deleted
inserted
replaced
85:f25d13153501 | 86:a8acf50bf7bb |
---|---|
690 | 690 |
691 # 扣除研發每人花費 8 GOLD | 691 # 扣除研發每人花費 8 GOLD |
692 return ($self->{cities}->{$cityId}->{citizens}->{total}*4 - $self->{cities}->{$cityId}->{citizens}->{scientists}*8 ); | 692 return ($self->{cities}->{$cityId}->{citizens}->{total}*4 - $self->{cities}->{$cityId}->{citizens}->{scientists}*8 ); |
693 } | 693 } |
694 | 694 |
695 sub getMilityExpenditure { | |
696 my $self = shift; | |
697 my $cityId = shift; | |
698 my $cities = $self->{cities}; | |
699 my $troops = { | |
700 # p 需要人口 | |
701 # w 木頭 | |
702 # S 硫磺 | |
703 # b 製造時間 | |
704 # u 維持費用 | |
705 # m 最低軍營等級 | |
706 # o 最佳軍營等級 | |
707 # a 攻擊力 | |
708 # d 防守力 | |
709 # A | |
710 # D | |
711 # s 耐力 | |
712 # c 種類 | |
713 # v speed | |
714 # x 加成 Assault, Resistance | |
715 Slinger => {n=>"Slinger",p=>1,w=>40,b=>"12m",u=>8,m=>1,o=>4,a=>7,d=>6,A=>2,D=>2,s=>10,c=>"Human",v=>20}, | |
716 Swordsman => {n=>"Swordsman",p=>2,w=>47,S=>16,b=>"17m",u=>16,m=>3,o=>5,a=>18,d=>14,A=>4,D=>3,s=>12,c=>"Human",v=>20,x=>"Assault"}, | |
717 Phalanx => {n=>"Phalanx",p=>4,w=>104,S=>64,b=>"40m",u=>24,m=>4,o=>7,a=>24,d=>40,A=>6,D=>10,s=>14,c=>"Human",v=>20,x=>"Resistance"}, | |
718 Ram => {n=>"Ram",p=>8,w=>198,S=>128,b=>"42m",u=>52,m=>5,o=>8,a=>14,d=>18,A=>3,D=>4,s=>16,c=>"Machina",v=>20,x=>"Ram"}, | |
719 Archer => {n=>"Archer",p=>4,w=>172,S=>86,b=>"49m",u=>32,m=>7,o=>10,a=>40,d=>40,A=>10,D=>10,s=>12,c=>"Human",v=>20}, | |
720 Catapult => {n=>"Catapult",p=>10,w=>342,S=>232,b=>"49m",u=>72,m=>10,o=>14,a=>36,d=>28,A=>9,D=>7,s=>16,c=>"Machina",v=>20,x=>"Ram"}, | |
721 Gunsman => {n=>"Gunsman",i=>"marksman",p=>7,w=>355,S=>154,b=>"1h 23m",u=>58,m=>14,o=>18,a=>80,d=>64,A=>18,D=>14,s=>10,c=>"Human",v=>20}, | |
722 Mortar => {n=>"Mortar",p=>12,w=>1325,S=>938,b=>"1h 53m",u=>128,m=>19,o=>21,a=>64,d=>64,A=>15,D=>15,s=>16,c=>"Machina",v=>20,x=>"Ram"}, | |
723 SteamGiant => {n=>"SteamGiant",i=>"steamgiant",p=>6,w=>1150,S=>716,b=>"1h 45m",u=>68,m=>16,o=>20,a=>100,d=>140,A=>20,D=>30,s=>14,c=>"Machina",v=>20,x=>"Resistance"}, | |
724 Gyrocopter => {n=>"Gyrocopter",p=>8,w=>1250,S=>670,b=>"1h 2m",u=>97,m=>12,o=>16,a=>112,d=>112,A=>25,D=>25,s=>12,c=>"Machina",v=>20}, | |
725 Bombardier => {n=>"Bombardier",p=>24,w=>2270,S=>878,b=>"2h 10m",u=>228,m=>22,o=>24,a=>200,d=>165,A=>45,D=>35,s=>14,c=>"Machina",v=>20,x=>"Assault"}, | |
726 Doctor => {n=>"Doctor",i=>"medic",p=>6,w=>640,C=>361,b=>"1h 2m",u=>244,m=>11,o=>12,a=>4,d=>28,A=>0,D=>0,s=>14,c=>"Human",v=>20,x=>"Healer"}, | |
727 Cook => {n=>"Cook",p=>4,w=>520,W=>103,b=>"38m",u=>138,m=>8,o=>8,a=>6,d=>26,A=>0,D=>0,s=>16,c=>"Human",v=>20,x=>"Regeneration"} | |
728 }; | |
729 | |
730 my $cost = 0; | |
731 | |
732 foreach(keys(%{$cities->{$cityId}->{army}})) { | |
733 # printf("%s %d = %d\n", $_, $cities->{$cityId}->{army}->{$_}, $cities->{$cityId}->{army}->{$_} * $troops->{$_}->{u}); | |
734 $cost += $cities->{$cityId}->{army}->{$_} * $troops->{$_}->{u}; | |
735 } | |
736 return $cost; | |
737 } | |
738 | |
695 sub blanceHurmanResource { | 739 sub blanceHurmanResource { |
696 my $self = shift; | 740 my $self = shift; |
697 my $cityId = shift; | 741 my $cityId = shift; |
698 my $workersRatio = { | 742 my $workersRatio = { |
699 'citizens' => 0.4, | 743 'citizens' => 0.4, |
711 | 755 |
712 # 換成生產人力 | 756 # 換成生產人力 |
713 my $freePeople = $self->{cities}->{$cityId}->{citizens}->{total} - ($produceworkers + $self->{cities}->{$cityId}->{scientists}); | 757 my $freePeople = $self->{cities}->{$cityId}->{citizens}->{total} - ($produceworkers + $self->{cities}->{$cityId}->{scientists}); |
714 | 758 |
715 # XXX | 759 # XXX |
716 Carp::carp(sprintf("suggested - produce: %s wood %s special %s\n", $produceworkers, int($freePeople*0.3), int($freePeople*0.7))); | 760 # 需計算資源開挖上限, 依照島等級區分 |
761 # 木頭 | |
762 # create_slider({ | |
763 # dir : 'ltr', | |
764 # id : "default", | |
765 # maxValue : 367, | |
766 # overcharge : 0, | |
767 # iniValue : 367, | |
768 # bg : "sliderbg", | |
769 # thumb : "sliderthumb", | |
770 # topConstraint: -10, | |
771 # bottomConstraint: 344, | |
772 # bg_value : "actualValue", | |
773 # bg_overcharge : "overcharge", | |
774 # textfield:"inputWorkers" | |
775 # }); | |
776 | |
777 # create_slider({ | |
778 # dir : 'ltr', | |
779 # id : "default", | |
780 # maxValue : 367, | |
781 # overcharge : 0, | |
782 # iniValue : 367, | |
783 # bg : "sliderbg", | |
784 # thumb : "sliderthumb", | |
785 # topConstraint: -10, | |
786 # bottomConstraint: 344, | |
787 # bg_value : "actualValue", | |
788 # bg_overcharge : "overcharge", | |
789 # textfield:"inputWorkers" | |
790 # }); | |
791 | |
792 Carp::carp(sprintf("Suggested HR palnning - produce: %s wood %s special %s\n", $produceworkers, int($freePeople*0.3), int($freePeople*0.7))); | |
717 } | 793 } |
718 | 794 |
719 sub logout | 795 sub logout |
720 { | 796 { |
721 my $self = shift; | 797 my $self = shift; |