Changeset b742eed7886f3481b15d9aa5e26b8564f0820d4e

Show
Ignore:
Timestamp:
05/12/08 17:29:30 (2 months ago)
Author:
Christopher Jung <bktheg@web.de>
git-committer:
Christopher Jung <bktheg@web.de> 1210606170 +0200
git-parent:

[cebb7b381e718b279c1dd4c9b938081350f6aeb2]

git-author:
Simon Dietsch <rhonabwy@sternenbund.org> 1210606170 +0200
Message:

[gameplay] Die Anzahl Jaeger, welche fuer die Torpedoabwehr herangezogen werden beschraenkt sich nun auf die Anzahl der verfuegbaren Jaegerdocks. Traeger ohne volle Crew zaehlen anteilig.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/net/driftingsouls/ds2/server/modules/ks/KSAttackAction.java

    rcebb7b3 rb742eed  
    4646import net.driftingsouls.ds2.server.ships.ShipTypeData; 
    4747import net.driftingsouls.ds2.server.ships.ShipTypes; 
     48import net.driftingsouls.ds2.server.ships.ShipClasses; 
    4849 
    4950import org.apache.commons.lang.math.RandomUtils; 
     
    778779         
    779780        private int getFighterDefense( Battle battle ) { 
    780                 int defcount = 0; 
    781                 int fightercount = 0; 
     781                int defcount = 0;               // Anzahl zu verteidigender Schiffe 
     782                int fighterdefcount = 0;// Gesamtpunktzahl an Bombenabwehr durch Jaeger 
     783                int gksdefcount = 0;    // Gesamtpunktzahl an Bombenabwehr durch GKS 
     784                int fighter = 0;                // Gesamtanzahl Jaeger 
     785                int gks = 0;                    // Gesamtanzahl GKS die Tropabwehr liefern 
     786                int docks = 0;                  // Gesamtanzahl Docks 
     787                int docksuse = 0;               // Gesamtanzahl an Schiffen, welche Docks brauchen 
    782788                 
    783789                List<BattleShip> enemyShips = battle.getEnemyShips(); 
    784790                for( int i=0; i < enemyShips.size(); i++ ) { 
    785791                        BattleShip selectedShip = enemyShips.get(i); 
    786                          
    787792                        ShipTypeData type = selectedShip.getTypeData(); 
    788                         if( (type.getTorpedoDef() == 0) && (type.getSize() > ShipType.SMALL_SHIP_MAXSIZE) ) { 
    789                                 defcount++; 
    790                         } 
    791                         if( (selectedShip.getDocked().length() == 0) && (selectedShip.getAction() & Battle.BS_FLUCHT) == 0 &&  
    792                                 (selectedShip.getAction() & Battle.BS_JOIN) == 0 ) { 
    793                                 fightercount += type.getTorpedoDef(); 
     793                         
     794                        double crewfactor = docks = docks + (int)(type.getJDocks() * selectedShip.getCrew()) / type.getCrew(); 
     795 
     796                         if((selectedShip.getAction() & Battle.BS_JOIN) == 0){ 
     797                                // Beitretende Schiffe werden grundsaetzlich ausgenommen, hier wird gar nichts berechnet 
     798                        }else if(type.getJDocks() > 0 && (selectedShip.getAction() & Battle.BS_FLUCHT) != 0 && type.getSize() > ShipType.SMALL_SHIP_MAXSIZE){ 
     799                                // Alle Schiffe mit Jaegerdocks die nicht auf der Flucht sind zaehlen a) als zu verteidigend und b) liefern Docks 
     800                                // Wenn wir allerdings nicht genug Crew haben koennen wir auch nicht alle Docks bedienen 
     801                                docks = docks + (int)Math.floor(type.getJDocks() * crewfactor); 
     802                                defcount = defcount + 1; 
     803                                // Wenn Schiffe mit Docks Torpabwehr stellen, dann hinzufuegen 
     804                                if(type.getTorpedoDef() > 0){ 
     805                                        gks = gks + 1; 
     806                                        gksdefcount = gksdefcount + (int)Math.floor(type.getTorpedoDef() * crewfactor); 
     807                                } 
     808                        }else if(type.getShipClass() == ShipClasses.JAEGER.ordinal() && (selectedShip.getAction() & Battle.BS_FLUCHT) != 0){ 
     809                                // Alle Jaeger zaehlen als docknutzend und liefern ihre Torpabwehr 
     810                                // Allerdings nur, wenn sie nicht fluechten. 
     811                                fighter = fighter + 1; 
     812                                fighterdefcount += (int)Math.floor(type.getTorpedoDef() * crewfactor); 
     813                                docksuse = docksuse + 1; 
     814                        }else if(type.getShipClass() == ShipClasses.BOMBER.ordinal()&& (selectedShip.getAction() & Battle.BS_FLUCHT) != 0 ){ 
     815                                // Bomber zaehlen als docknutzend, ausser sie fluechten 
     816                                docksuse = docksuse + 1; 
     817                        }else if(type.getSize() > ShipType.SMALL_SHIP_MAXSIZE){ 
     818                                // GKS ohne Docks muessen auch verteidigt werden 
     819                                defcount = defcount + 1; 
     820                                // Wenn Schiffe Torpabwehr stellen, dann hinzufuegen 
     821                                if(type.getTorpedoDef() > 0){ 
     822                                        gks = gks + 1; 
     823                                        gksdefcount = gksdefcount + (int)Math.floor(type.getTorpedoDef() * crewfactor); 
     824                                }                                
     825                        }else{ 
     826                                // TODO: Hier die Faelle einfuegen, die ich vergessen habe  
    794827                        } 
    795828                } 
     
    797830                        defcount = 1;    
    798831                } 
    799                 int fighterdef = (int)Math.round((fightercount/(double)defcount)/localweapon.getDouble("destroyable")); 
     832                // Rechnen wir mal die endgueltige Verteidigung aus 
     833                if (docksuse > docks){ 
     834                        fighterdefcount = (int)Math.floor((fighterdefcount/(double)fighter)*docks); 
     835                } 
     836                int fighterdef = (int)Math.round(((fighterdefcount + gksdefcount)/(double)defcount)/localweapon.getDouble("destroyable")); 
    800837                if( fighterdef > 100 ) { 
    801838                        fighterdef = 100;