Changeset 390f9f11c7479698e59748f483bde407a806cace
- Timestamp:
- 09/23/07 18:44:15
(1 year ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1190565855 +0200
- git-parent:
[fc42460aa180429c80c001911fa4703883a998c1]
- git-author:
- Simon Dietsch <rhonabwy@arcor.de> 1190565855 +0200
- Message:
Marines
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4e34802 |
r390f9f1 |
|
| 24 | 24 | `autogtuacts` text NOT NULL default '', |
|---|
| 25 | 25 | `version` int(11) NOT NULL default '0', |
|---|
| | 26 | `marines` int unsigned NOT NULL default '0', |
|---|
| 26 | 27 | PRIMARY KEY (`id`), |
|---|
| 27 | 28 | KEY `owner` (`owner`,`id`), |
|---|
| r870bccb |
r390f9f1 |
|
| 37 | 37 | `hide` tinyint(1) NOT NULL default '0', |
|---|
| 38 | 38 | `srs` tinyint NOT NULL default '1', |
|---|
| 39 | | `ship_types` ADD `scanCost` INT NOT NULL default '0', |
|---|
| 40 | | `ship_types` ADD `pickingCost` INT NOT NULL default '0', |
|---|
| | 39 | `scanCost` INT NOT NULL default '0', |
|---|
| | 40 | `pickingCost` INT NOT NULL default '0', |
|---|
| | 41 | `marines` int unsigned NOT NULL default '0', |
|---|
| 41 | 42 | PRIMARY KEY (`id`) |
|---|
| 42 | 43 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
|---|
| r2193fdb |
r390f9f1 |
|
| 41 | 41 | `respawn` tinyint(4) default NULL, |
|---|
| 42 | 42 | `startFighters` tinyint(3) unsigned NOT NULL default '1', |
|---|
| | 43 | `marines` int unsigned NOT NULL default '0', |
|---|
| 43 | 44 | PRIMARY KEY (`id`), |
|---|
| 44 | 45 | KEY `coords` (`x`,`y`,`system`), |
|---|
| r870bccb |
r390f9f1 |
|
| 34 | 34 | `scanCost` INT NOT NULL DEFAULT '0', |
|---|
| 35 | 35 | `pickingCost` INT NOT NULL DEFAULT '0', |
|---|
| | 36 | `marines` int unsigned NOT NULL default '0', |
|---|
| 36 | 37 | PRIMARY KEY (`id`) |
|---|
| 37 | 38 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='modifizierte Schiffstypenwerte fuer "jedes" Schiff'; |
|---|
| r870bccb |
r390f9f1 |
|
| 406 | 406 | ALTER TABLE `ship_types` ADD `pickingCost` INT NOT NULL ; |
|---|
| 407 | 407 | ]]></update> |
|---|
| | 408 | <update type="structure" datum="2007-09-23"><![CDATA[ |
|---|
| | 409 | alter table `bases` add `marines` int unsigned not null default '0'; |
|---|
| | 410 | alter table `ships` add `marines` int unsigned not null default '0'; |
|---|
| | 411 | alter table `ship_types` add `marines` int unsigned not null default '0'; |
|---|
| | 412 | alter table `ships_modules` add `marines` int unsigned not null default '0'; |
|---|
| | 413 | ]]></update> |
|---|
| 408 | 414 | </updates> |
|---|
| refe50c3 |
r390f9f1 |
|
| 74 | 74 | private int system; |
|---|
| 75 | 75 | private int bewohner; |
|---|
| | 76 | private int marines; |
|---|
| 76 | 77 | private int arbeiter; |
|---|
| 77 | 78 | @Column(name="e") |
|---|
| … | … | |
| 393 | 394 | public void setBewohner(int bewohner) { |
|---|
| 394 | 395 | this.bewohner = bewohner; |
|---|
| | 396 | } |
|---|
| | 397 | |
|---|
| | 398 | public int getMarines() { |
|---|
| | 399 | return this.marines; |
|---|
| | 400 | } |
|---|
| | 401 | |
|---|
| | 402 | public void setMarines(int marines){ |
|---|
| | 403 | this.marines = marines; |
|---|
| 395 | 404 | } |
|---|
| 396 | 405 | |
|---|
| rdf3f9e5 |
r390f9f1 |
|
| 293 | 293 | return ship.getCrew(); |
|---|
| 294 | 294 | } |
|---|
| | 295 | |
|---|
| | 296 | /** |
|---|
| | 297 | * Gibt die Marineanzahl auf dem Schiff zurueck |
|---|
| | 298 | * @return Die Marineanzahl |
|---|
| | 299 | * @see net.driftingsouls.ds2.server.ships.Ship#getMarines() |
|---|
| | 300 | */ |
|---|
| | 301 | public int getMarines() { |
|---|
| | 302 | return ship.getMarines(); |
|---|
| | 303 | } |
|---|
| 295 | 304 | |
|---|
| 296 | 305 | /** |
|---|
| r7375108 |
r390f9f1 |
|
| 190 | 190 | "shipinfo.type.maxenergy", shipType.getEps(), |
|---|
| 191 | 191 | "shipinfo.type.maxcrew", shipType.getCrew(), |
|---|
| | 192 | "shipinfo.type.maxmarines", shipType.getMarines(), |
|---|
| 192 | 193 | "shipinfo.type.weapons", shipType.isMilitary(), |
|---|
| 193 | 194 | "shipinfo.hull", Common.ln(ship.getShip().getHull()), |
|---|
| … | … | |
| 199 | 200 | "shipinfo.energy", ship.getShip().getEnergy(), |
|---|
| 200 | 201 | "shipinfo.crew", ship.getShip().getCrew(), |
|---|
| | 202 | "shipinfo.marines", ship.getShip().getMarines(), |
|---|
| 201 | 203 | "shipinfo.engine", ship.getShip().getEngine(), |
|---|
| 202 | 204 | "shipinfo.weapons", ship.getShip().getWeapons(), |
|---|
| r7375108 |
r390f9f1 |
|
| 50 | 50 | public int getCrew(); |
|---|
| 51 | 51 | /** |
|---|
| | 52 | * * Gibt die verfuegbaren Marines zurueck |
|---|
| | 53 | * @return Die Marines |
|---|
| | 54 | */ |
|---|
| | 55 | public int getMarines(); |
|---|
| | 56 | /** |
|---|
| 52 | 57 | * Setzt die Crew auf dem Objekt |
|---|
| 53 | 58 | * @param crew Die Crew |
|---|
| … | … | |
| 55 | 60 | public void setCrew(int crew); |
|---|
| 56 | 61 | /** |
|---|
| | 62 | * * Setzt die Marines auf dem Objekt |
|---|
| | 63 | * @param marines Die Marines |
|---|
| | 64 | */ |
|---|
| | 65 | public void setMarines(int marines); |
|---|
| | 66 | /** |
|---|
| 57 | 67 | * Wird am Ende des Transfervorgangs aufgerufen |
|---|
| 58 | 68 | * |
|---|
| … | … | |
| 79 | 89 | */ |
|---|
| 80 | 90 | public int getMaxCrew(); |
|---|
| | 91 | /** |
|---|
| | 92 | * Gibt die maximale Anzahl an Marines auf dem Objekt zurueck |
|---|
| | 93 | * @return Die maximale Menge Marines (<code>-1</code> = unbegrenzt) |
|---|
| | 94 | */ |
|---|
| | 95 | public int getMaxMarines(); |
|---|
| 81 | 96 | } |
|---|
| 82 | 97 | |
|---|
| … | … | |
| 99 | 114 | return ship.getCrew(); |
|---|
| 100 | 115 | } |
|---|
| | 116 | |
|---|
| | 117 | public int getMarines() { |
|---|
| | 118 | return ship.getMarines(); |
|---|
| | 119 | } |
|---|
| 101 | 120 | |
|---|
| 102 | 121 | public int getId() { |
|---|
| … | … | |
| 111 | 130 | ship.setCrew(crew); |
|---|
| 112 | 131 | } |
|---|
| | 132 | |
|---|
| | 133 | public void setMarines(int marines) { |
|---|
| | 134 | ship.setMarines(marines); |
|---|
| | 135 | } |
|---|
| 113 | 136 | |
|---|
| 114 | 137 | public int getMaxCrew() { |
|---|
| 115 | 138 | return ship.getTypeData().getCrew(); |
|---|
| 116 | 139 | } |
|---|
| 117 | | |
|---|
| | 140 | |
|---|
| | 141 | public int getMaxMarines() { |
|---|
| | 142 | return ship.getTypeData().getMarines(); |
|---|
| | 143 | } |
|---|
| | 144 | |
|---|
| 118 | 145 | public User getOwner() { |
|---|
| 119 | 146 | return ship.getOwner(); |
|---|
| … | … | |
| 158 | 185 | public User getOwner() { |
|---|
| 159 | 186 | return base.getOwner(); |
|---|
| | 187 | } |
|---|
| | 188 | |
|---|
| | 189 | public int getMarines() { |
|---|
| | 190 | return base.getMarines(); |
|---|
| | 191 | } |
|---|
| | 192 | |
|---|
| | 193 | public int getMaxMarines() { |
|---|
| | 194 | return -1; |
|---|
| | 195 | } |
|---|
| | 196 | |
|---|
| | 197 | public void setMarines(int marines) { |
|---|
| | 198 | base.setMarines(marines); |
|---|
| 160 | 199 | } |
|---|
| 161 | 200 | } |
|---|
| … | … | |
| 164 | 203 | private Target datat = null; |
|---|
| 165 | 204 | private int maxcrewf; |
|---|
| | 205 | private int maxmarines; |
|---|
| 166 | 206 | |
|---|
| 167 | 207 | /** |
|---|
| … | … | |
| 197 | 237 | Target datat = null; |
|---|
| 198 | 238 | int maxcrewf = 0; |
|---|
| | 239 | int maxmarines = 0; |
|---|
| 199 | 240 | |
|---|
| 200 | 241 | if( mode.equals("ss") ) { |
|---|
| … | … | |
| 208 | 249 | |
|---|
| 209 | 250 | maxcrewf = ship.getTypeData().getCrew(); |
|---|
| | 251 | maxmarines = ship.getTypeData().getMarines(); |
|---|
| 210 | 252 | datat = new ShipTarget(aship); |
|---|
| 211 | 253 | } |
|---|
| … | … | |
| 220 | 262 | |
|---|
| 221 | 263 | maxcrewf = ship.getTypeData().getCrew(); |
|---|
| | 264 | maxmarines = ship.getTypeData().getMarines(); |
|---|
| 222 | 265 | datat = new BaseTarget(abase); |
|---|
| 223 | 266 | } |
|---|
| … | … | |
| 236 | 279 | this.datat = datat; |
|---|
| 237 | 280 | this.maxcrewf = maxcrewf; |
|---|
| | 281 | this.maxmarines = maxmarines; |
|---|
| 238 | 282 | |
|---|
| 239 | 283 | return true; |
|---|
| … | … | |
| 242 | 286 | /** |
|---|
| 243 | 287 | * Transferiert Crew vom Ausgangsschiff zum Zielschiff/Basis |
|---|
| | 288 | * Transferiert Crew/Marines vom Ausgangsschiff zum Zielschiff/Basis |
|---|
| 244 | 289 | * @urlparam int send Die Anzahl der zu transferierenden Crew |
|---|
| | 290 | * @urlparam int sendm Die Anzahl der zu transferierenden Marines |
|---|
| 245 | 291 | * |
|---|
| 246 | 292 | */ |
|---|
| … | … | |
| 272 | 318 | ship.recalculateShipStatus(); |
|---|
| 273 | 319 | } |
|---|
| | 320 | parameterNumber("sendm"); |
|---|
| | 321 | int sendm = getInteger("sendm"); |
|---|
| | 322 | if( sendm < 0 ) { |
|---|
| | 323 | sendm = 0; |
|---|
| | 324 | } |
|---|
| | 325 | if( (datat.getMaxMarines() > -1) && (sendm > datat.getMaxMarines() - datat.getMarines()) ) { |
|---|
| | 326 | sendm = datat.getMaxMarines() - datat.getMarines(); |
|---|
| | 327 | } |
|---|
| | 328 | if( sendm > ship.getMarines() ) { |
|---|
| | 329 | sendm = ship.getMarines(); |
|---|
| | 330 | } |
|---|
| | 331 | |
|---|
| | 332 | if( sendm > 0 ) { |
|---|
| | 333 | t.setVar( "marinestausch.transfer", 1, |
|---|
| | 334 | "transfer.way.to", 1, |
|---|
| | 335 | "transfer.mcount", sendm ); |
|---|
| | 336 | |
|---|
| | 337 | ship.setMarines(ship.getMarines()-sendm); |
|---|
| | 338 | datat.setMarines(datat.getMarines()+sendm); |
|---|
| | 339 | datat.finishTransfer(); |
|---|
| | 340 | ship.recalculateShipStatus(); |
|---|
| | 341 | } |
|---|
| 274 | 342 | redirect(); |
|---|
| 275 | 343 | } |
|---|
| … | … | |
| 277 | 345 | /** |
|---|
| 278 | 346 | * Transfer in umgekehrter Richtung.<br> |
|---|
| 279 | | * Transferiert Crew vom Zielschiff/Basis zum Ausgangsschiff |
|---|
| | 347 | * Transferiert Crew/Marines vom Zielschiff/Basis zum Ausgangsschiff |
|---|
| 280 | 348 | * @urlparam int rec Die Anzahl der zu transferierenden Crew |
|---|
| | 349 | * @urlparam int recm Die Anzahl der zu transferierenden Marines |
|---|
| 281 | 350 | * |
|---|
| 282 | 351 | */ |
|---|
| … | … | |
| 287 | 356 | parameterNumber("rec"); |
|---|
| 288 | 357 | int rec = getInteger("rec"); |
|---|
| | 358 | parameterNumber("recm"); |
|---|
| | 359 | int recm = getInteger("recm"); |
|---|
| 289 | 360 | |
|---|
| 290 | 361 | if( rec < 0 ) { |
|---|
| … | … | |
| 308 | 379 | ship.recalculateShipStatus(); |
|---|
| 309 | 380 | } |
|---|
| | 381 | if( recm < 0 ) { |
|---|
| | 382 | recm = 0; |
|---|
| | 383 | } |
|---|
| | 384 | if( recm > maxmarines - ship.getMarines() ) { |
|---|
| | 385 | recm = maxmarines - ship.getMarines(); |
|---|
| | 386 | } |
|---|
| | 387 | if( recm > datat.getMarines() ) { |
|---|
| | 388 | recm = datat.getMarines(); |
|---|
| | 389 | } |
|---|
| | 390 | if( recm > 0 ) { |
|---|
| | 391 | t.setVar( "marinestausch.transfer", 1, |
|---|
| | 392 | "transfer.way.to", 0, |
|---|
| | 393 | "transfer.mcount", recm ); |
|---|
| | 394 | |
|---|
| | 395 | ship.setMarines(ship.getMarines()+recm); |
|---|
| | 396 | datat.setMarines(datat.getMarines()-recm); |
|---|
| | 397 | datat.finishTransfer(); |
|---|
| | 398 | ship.recalculateShipStatus(); |
|---|
| | 399 | } |
|---|
| 310 | 400 | |
|---|
| 311 | 401 | redirect(); |
|---|
| … | … | |
| 326 | 416 | "ship.crew", ship.getCrew(), |
|---|
| 327 | 417 | "ship.maxcrew", maxcrewf, |
|---|
| | 418 | "ship.marines", ship.getMarines(), |
|---|
| | 419 | "ship.maxmarines", maxmarines, |
|---|
| 328 | 420 | "target.id", datat.getId(), |
|---|
| 329 | 421 | "target.name", datat.getName(), |
|---|
| 330 | 422 | "target.crew", datat.getCrew(), |
|---|
| 331 | 423 | "target.maxcrew", (datat.getMaxCrew() > -1 ? datat.getMaxCrew() : "∞"), |
|---|
| | 424 | "target.marines", datat.getMarines(), |
|---|
| | 425 | "target.maxmarines", (datat.getMaxMarines() > -1 ? datat.getMaxMarines() : "∞"), |
|---|
| 332 | 426 | "global.mode", mode, |
|---|
| 333 | 427 | "global.mode.ss", mode.equals("ss"), |
|---|
| r7375108 |
r390f9f1 |
|
| 253 | 253 | |
|---|
| 254 | 254 | int acrew = this.ownShip.getCrew(); |
|---|
| | 255 | int amarines = this.ownShip.getMarines(); |
|---|
| 255 | 256 | int dcrew = this.targetShip.getCrew(); |
|---|
| | 257 | int dmarines = this.targetShip.getMarines(); |
|---|
| 256 | 258 | |
|---|
| 257 | 259 | ShipTypeData ownShipType = this.ownShip.getTypeData(); |
|---|
| … | … | |
| 263 | 265 | |
|---|
| 264 | 266 | // Falls Crew auf dem Zielschiff vorhanden ist |
|---|
| 265 | | if( this.targetShip.getCrew() != 0 ) { |
|---|
| | 267 | if( this.targetShip.getCrew() != 0 || this.targetShip.getMarines() != 0) { |
|---|
| 266 | 268 | if( this.targetShipType.getCrew() == 0 ) { |
|---|
| 267 | 269 | addError("Dieses Schiff ist nicht kaperbar", errorurl); |
|---|
| … | … | |
| 335 | 337 | |
|---|
| 336 | 338 | int defmulti = 1; |
|---|
| | 339 | int attmulti = 1; |
|---|
| 337 | 340 | |
|---|
| 338 | 341 | Offizier offizier = Offizier.getOffizierByDest('s', this.targetShip.getId()); |
|---|
| | 342 | Offizier aoffizier = Offizier.getOffizierByDest('s', this.ownShip.getId()); |
|---|
| 339 | 343 | if( offizier != null ) { |
|---|
| 340 | 344 | defmulti = (int)Math.round(offizier.getAbility(Offizier.Ability.SEC)/25d)+1; |
|---|
| 341 | 345 | } |
|---|
| 342 | | |
|---|
| 343 | | if( acrew >= dcrew*3*defmulti ) { |
|---|
| | 346 | if(aoffizier != null){ |
|---|
| | 347 | attmulti = (int)Math.round(aoffizier.getAbility(Offizier.Ability.COM)/25d)+1; |
|---|
| | 348 | } |
|---|
| | 349 | |
|---|
| | 350 | if( amarines*attmulti >= dcrew*3*defmulti + dmarines*3*defmulti) { |
|---|
| 344 | 351 | ok = true; |
|---|
| 345 | 352 | |
|---|
| … | … | |
| 350 | 357 | //$dcrew = round(($dcrew*$defmulti - $acrew)/$defmulti); |
|---|
| 351 | 358 | |
|---|
| 352 | | if( Math.round((dcrew*defmulti - acrew)/defmulti) > 0 ) { |
|---|
| 353 | | int oldacrew = acrew; |
|---|
| | 359 | if( Math.round(dcrew*defmulti + dmarines*defmulti - amarines*attmulti) > 0 ) { |
|---|
| | 360 | int oldamarines = amarines; |
|---|
| | 361 | //int oldacrew = acrew; |
|---|
| 354 | 362 | int olddcrew = dcrew; |
|---|
| 355 | | acrew = (int)Math.round(acrew * 0.1); |
|---|
| 356 | | if( acrew < 1 ) { |
|---|
| 357 | | acrew = 1; |
|---|
| | 363 | int olddmarines = dmarines; |
|---|
| | 364 | amarines = (int)Math.round(amarines * 0.1); |
|---|
| | 365 | if( amarines < 1 ) { |
|---|
| | 366 | amarines = 0; |
|---|
| 358 | 367 | } |
|---|
| 359 | 368 | |
|---|
| 360 | | dcrew = Math.round((dcrew*defmulti - oldacrew+acrew)/defmulti); |
|---|
| 361 | | |
|---|
| 362 | | t.setVar("kapern.message", kapermessage+"Der Feind verteidigt das Schiff:<br />"+(oldacrew-acrew)+" Crewmitglieder fallen.<br />"+(olddcrew-dcrew)+" Feinde getötet.<br /><br /><span style=\"color:red\">Angriff abgebrochen</span>" ); |
|---|
| 363 | | msg.append("Ihre Crew verteidigt das Schiff:\n"+(oldacrew-acrew)+" Feinde werden erschossen.\n"+(olddcrew-dcrew)+" Besatzungsmitglieder haben ihr leben gelassen.\n\n[color=green]Der Feind flieht[/color]\n"); |
|---|
| | 369 | if( Math.round(dmarines*defmulti - oldamarines*attmulti) >= 0){ |
|---|
| | 370 | dmarines = Math.round(dmarines*defmulti - oldamarines*attmulti); |
|---|
| | 371 | }else{ |
|---|
| | 372 | dmarines = 0; |
|---|
| | 373 | dcrew = Math.round(dcrew*defmulti - (oldamarines*attmulti - dmarines*defmulti)); |
|---|
| | 374 | } |
|---|
| | 375 | |
|---|
| | 376 | t.setVar("kapern.message", kapermessage+"Der Feind verteidigt das Schiff:<br />"+(oldamarines-amarines)+" Marines fallen.<br />"+(olddmarines-dmarines)+" Marines und "+(olddcrew-dcrew)+" Besatzungsmitglieder getötet.<br /><br /><span style=\"color:red\">Angriff abgebrochen</span>" ); |
|---|
| | 377 | msg.append("Ihre Crew verteidigt das Schiff:\n"+(oldamarines-amarines)+" Marines werden erschossen.\n"+(olddmarines-dmarines)+" Marines und "+(olddcrew-dcrew)+" Besatzungsmitglieder haben ihr leben gelassen.\n\n[color=green]Der Feind flieht[/color]\n"); |
|---|
| 364 | 378 | |
|---|
| 365 | 379 | ok = false; |
|---|
| 366 | 380 | } |
|---|
| 367 | 381 | else { |
|---|
| 368 | | t.setVar("kapern.message", kapermessage+"Der Feind verteidigt das Schiff:<br />"+Math.round(dcrew*defmulti)+" Crewmitglieder fallen.<br />"+dcrew+" Feinde getötet" ); |
|---|
| 369 | | msg.append("Ihre Crew verteidigt das Schiff:\n"+Math.round(dcrew*defmulti)+" Feinde werden erschossen.\n"+dcrew+" Besatzungsmitglieder haben ihr leben gelassen.\n\n[color=red]Die "+this.targetShip.getName()+" ist verloren[/color]\n"); |
|---|
| 370 | | |
|---|
| 371 | | acrew -= Math.round(dcrew*defmulti); |
|---|
| | 382 | int oldamarines = amarines; |
|---|
| | 383 | int olddcrew = dcrew; |
|---|
| | 384 | int olddmarines = dmarines; |
|---|
| | 385 | amarines = Math.round(amarines*attmulti - (dcrew*defmulti + dmarines*defmulti)); |
|---|
| | 386 | |
|---|
| 372 | 387 | dcrew = 0; |
|---|
| | 388 | dmarines = 0; |
|---|
| | 389 | |
|---|
| | 390 | t.setVar("kapern.message", kapermessage+"Der Feind verteidigt das Schiff:<br />"+(oldamarines-amarines)+" Marines fallen.<br />"+(olddmarines-dmarines)+" Marines und "+(olddcrew-dcrew)+" Besatzungsmitglieder getötet" ); |
|---|
| | 391 | msg.append("Ihre Crew verteidigt das Schiff:\n"+(oldamarines-amarines)+" Marines werden erschossen.\n"+Math.round(dcrew*defmulti)+" Feinde Besatzungsmitglieder haben ihr leben gelassen.\n\n[color=red]Die "+this.targetShip.getName()+" ist verloren[/color]\n"); |
|---|
| | 392 | |
|---|
| 373 | 393 | ok = true; |
|---|
| 374 | 394 | } |
|---|
| … | … | |
| 391 | 411 | |
|---|
| 392 | 412 | this.ownShip.setCrew(acrew); |
|---|
| | 413 | this.ownShip.setMarines(amarines); |
|---|
| 393 | 414 | this.targetShip.setCrew(dcrew); |
|---|
| | 415 | this.targetShip.setMarines(dmarines); |
|---|
| 394 | 416 | |
|---|
| 395 | 417 | // Wurde das Schiff gekapert? |
|---|
| rb035981 |
r390f9f1 |
|
| 1237 | 1237 | "ship.sensors", ship.getSensors(), |
|---|
| 1238 | 1238 | "shiptype.crew", Common.ln(shiptype.getCrew()), |
|---|
| | 1239 | "shiptype.marines", Common.ln(shiptype.getMarines()), |
|---|
| 1239 | 1240 | "ship.crew", Common.ln(ship.getCrew()), |
|---|
| 1240 | 1241 | "ship.crew.color", genSubColor(ship.getCrew(), shiptype.getCrew()), |
|---|
| | 1242 | "ship.marines.color", genSubColor(ship.getMarines(), shiptype.getMarines()), |
|---|
| 1241 | 1243 | "ship.e", Common.ln(ship.getEnergy()), |
|---|
| 1242 | 1244 | "shiptype.eps", Common.ln(shiptype.getEps()), |
|---|
| refe50c3 |
r390f9f1 |
|
| 143 | 143 | |
|---|
| 144 | 144 | User euser = enemyShip.getOwner(); |
|---|
| 145 | | |
|---|
| 146 | | int savecrew = (int)Math.round(ownShip.getCrew()/10d); |
|---|
| 147 | | if( savecrew <= 0 ) { |
|---|
| 148 | | savecrew = 1; |
|---|
| 149 | | } |
|---|
| 150 | | int acrew = ownShip.getCrew() - savecrew; |
|---|
| | 145 | |
|---|
| | 146 | int amarines = ownShip.getMarines(); //angreifende Marines |
|---|
| | 147 | int acrew = ownShip.getCrew(); |
|---|
| | 148 | int dmarines = enemyShip.getMarines(); //verteidigende Marines |
|---|
| 151 | 149 | int dcrew = enemyShip.getCrew(); |
|---|
| 152 | 150 | |
|---|
| 153 | 151 | boolean ok = false; |
|---|
| 154 | | int keepcrew = 0; |
|---|
| 155 | 152 | |
|---|
| 156 | 153 | String msg = ""; |
|---|
| 157 | | if( (acrew != 0) && (dcrew != 0) ) { |
|---|
| | 154 | if( (amarines != 0) && ((dcrew != 0) || dmarines != 0 ) ) { |
|---|
| 158 | 155 | battle.logme("Die Crew stürmt das Schiff\n"); |
|---|
| 159 | 156 | msg = "Die Crew der "+Battle.log_shiplink(ownShip.getShip())+" stürmt die "+Battle.log_shiplink(enemyShip.getShip())+"\n"; |
|---|
| … | … | |
| 165 | 162 | defmulti = (int)Math.round(offizier.getAbility(Offizier.Ability.SEC)/25d)+1; |
|---|
| 166 | 163 | } |
|---|
| 167 | | |
|---|
| 168 | | if( acrew >= dcrew*3*defmulti ) { |
|---|
| | 164 | // angreifenden Offizier hinzufuegen |
|---|
| | 165 | int attmulti = 1; |
|---|
| | 166 | Offizier aoffizier = Offizier.getOffizierByDest('s', ownShip.getId()); |
|---|
| | 167 | if( aoffizier != null ) { |
|---|
| | 168 | attmulti = (int)Math.round(aoffizier.getAbility(Offizier.Ability.COM)/25d)+1; |
|---|
| | 169 | } |
|---|
| | 170 | |
|---|
| | 171 | if( amarines*attmulti >= dcrew*3*defmulti + dmarines*3*defmulti) { |
|---|
| 169 | 172 | ok = true; |
|---|
| 170 | 173 | battle.logme("Die Crew gibt das Schiff kampflos auf und läuft über\n"); |
|---|
| 171 | 174 | msg += "Die Crew gibt das Schiff kampflos auf läuft über.\n"; |
|---|
| 172 | | keepcrew = dcrew; |
|---|
| 173 | 175 | } |
|---|
| 174 | 176 | else { |
|---|
| 175 | 177 | //$dcrew = round(($dcrew*$defmulti - $acrew)/$defmulti); |
|---|
| 176 | | if( dcrew*defmulti - acrew > 0 ) { |
|---|
| 177 | | int oldacrew = acrew; |
|---|
| | 178 | if( Math.round(dcrew*defmulti + dmarines*defmulti - amarines*attmulti) > 0 ) { |
|---|
| | 179 | int oldamarines = amarines; |
|---|
| 178 | 180 | int olddcrew = dcrew; |
|---|
| 179 | | acrew = (int)Math.round(acrew * 0.1); |
|---|
| 180 | | if( acrew < 1 ) { |
|---|
| 181 | | acrew = 1; |
|---|
| | 181 | int olddmarines = dmarines; |
|---|
| | 182 | amarines = (int)Math.round(amarines * 0.1); |
|---|
| | 183 | if( amarines < 1 ) { |
|---|
| | 184 | amarines = 0; |
|---|
| 182 | 185 | } |
|---|
| 183 | 186 | |
|---|
| 184 | | dcrew = (int)Math.round((dcrew*defmulti - oldacrew+acrew)/(double)defmulti); |
|---|
| 185 | | battle.logme((oldacrew-acrew)+" Crewmitglieder fallen. "+(olddcrew-dcrew)+" Feinde getötet.\nAngriff abgebrochen\n"); |
|---|
| 186 | | msg += (oldacrew-acrew)+" Angreifer erschossen. "+(olddcrew-dcrew)+" Crewmitglieder sind gefallen.\nDer Angreifer flieht\n"; |
|---|
| | 187 | /* wenn der verteidiger mehr marines hat als der angreifen, dann nur marines berechnen |
|---|
| | 188 | * hat der verteidiger nur mit crew mehr verteidigung, dann beides berechnen*/ |
|---|
| | 189 | if( Math.round(dmarines*defmulti - oldamarines*attmulti) >= 0){ |
|---|
| | 190 | dmarines = Math.round(dmarines*defmulti - oldamarines*attmulti); |
|---|
| | 191 | }else{ |
|---|
| | 192 | dmarines = 0; |
|---|
| | 193 | dcrew = Math.round(dcrew*defmulti - (oldamarines*attmulti - dmarines*defmulti)); |
|---|
| | 194 | } |
|---|
| | 195 | battle.logme((oldamarines-amarines)+" Marines fallen. "+(olddmarines-dmarines) +" Marines und "+ (olddcrew-dcrew)+" Besatzungsmitglieder getötet.\nAngriff abgebrochen\n"); |
|---|
| | 196 | msg += (oldamarines-amarines)+" Angreifer erschossen. "+(olddcrew-dcrew)+" Crewmitglieder und "+ (olddmarines-dmarines) +"Marines sind gefallen.\nDer Angreifer flieht\n"; |
|---|
| | 197 | |
|---|
| 187 | 198 | ok = false; |
|---|
| 188 | 199 | |
|---|
| … | … | |
| 209 | 220 | battle.logenemy("]]></action>\n"); |
|---|
| 210 | 221 | |
|---|
| 211 | | ownShip.getShip().setCrew(acrew+savecrew); |
|---|
| | 222 | ownShip.getShip().setMarines(amarines); |
|---|
| 212 | 223 | ownShip.getShip().setBattleAction(true); |
|---|
| 213 | 224 | enemyShip.getShip().setCrew(dcrew); |
|---|
| | 225 | enemyShip.getShip().setMarines(dmarines); |
|---|
| 214 | 226 | } |
|---|
| 215 | 227 | |
|---|
| … | … | |
| 242 | 254 | int newshipcrew = 0; |
|---|
| 243 | 255 | if( (acrew != 0) && (dcrew == 0) ) { |
|---|
| 244 | | newshipcrew = acrew; |
|---|
| | 256 | newshipcrew = acrew/2; |
|---|
| 245 | 257 | if( newshipcrew > enemyShipType.getCrew() ) { |
|---|
| 246 | 258 | newshipcrew = enemyShipType.getCrew(); |
|---|
| 247 | 259 | } |
|---|
| 248 | | acrew -= newshipcrew; |
|---|
| 249 | | |
|---|
| 250 | | ownShip.getShip().setCrew(acrew+savecrew); |
|---|
| 251 | | |
|---|
| 252 | | battle.logme( (newshipcrew+keepcrew)+" Crewmitglieder werden auf dem gekaperten Schiff stationiert\n" ); |
|---|
| 253 | | } |
|---|
| 254 | | newshipcrew += keepcrew; |
|---|
| | 260 | acrew = acrew -newshipcrew; |
|---|
| | 261 | |
|---|
| | 262 | ownShip.getShip().setCrew(acrew); |
|---|
| | 263 | |
|---|
| | 264 | battle.logme( (newshipcrew)+" Crewmitglieder werden auf dem gekaperten Schiff stationiert\n" ); |
|---|
| | 265 | } |
|---|
| 255 | 266 | |
|---|
| 256 | 267 | String currentTime = Common.getIngameTime(context.get(ContextCommon.class).getTick()); |
|---|
| r870bccb |
r390f9f1 |
|
| 75 | 75 | return inner.getCrew(); |
|---|
| 76 | 76 | } |
|---|
| | 77 | |
|---|
| | 78 | public int getMarines() { |
|---|
| | 79 | return inner.getMarines(); |
|---|
| | 80 | } |
|---|
| 77 | 81 | |
|---|
| 78 | 82 | public String getDescrip() { |
|---|
| r870bccb |
r390f9f1 |
|
| 113 | 113 | private String status; |
|---|
| 114 | 114 | private int crew; |
|---|
| | 115 | private int marines; |
|---|
| 115 | 116 | private int e; |
|---|
| 116 | 117 | @Column(name="s") |
|---|
| … | … | |
| 414 | 415 | |
|---|
| 415 | 416 | /** |
|---|
| | 417 | * Gibt die Anzahl Marines auf dem Schiff zurueck |
|---|
| | 418 | * @return Die Anzahl Marines |
|---|
| | 419 | */ |
|---|
| | 420 | public int getMarines() { |
|---|
| | 421 | return marines; |
|---|
| | 422 | } |
|---|
| | 423 | |
|---|
| | 424 | /** |
|---|
| | 425 | * Setzt die Anzahl Marines auf dem Schiff |
|---|
| | 426 | * @param marines Die neue Anzahl Marines |
|---|
| | 427 | */ |
|---|
| | 428 | public void setMarines(int marines) { |
|---|
| | 429 | this.marines = marines; |
|---|
| | 430 | } |
|---|
| | 431 | |
|---|
| | 432 | /** |
|---|
| 416 | 433 | * Gibt die Energiemenge auf dem Schiff zurueck |
|---|
| 417 | 434 | * @return Die Energiemenge |
|---|
| r870bccb |
r390f9f1 |
|
| 56 | 56 | private int heat; |
|---|
| 57 | 57 | private int crew; |
|---|
| | 58 | private int marines; |
|---|
| 58 | 59 | private String weapons; |
|---|
| 59 | 60 | @Column(name="maxheat") |
|---|
| … | … | |
| 162 | 163 | this.crew = crew; |
|---|
| 163 | 164 | } |
|---|
| | 165 | |
|---|
| | 166 | |
|---|
| | 167 | public int getMarines() { |
|---|
| | 168 | return marines; |
|---|
| | 169 | } |
|---|
| | 170 | |
|---|
| | 171 | /** |
|---|
| | 172 | * Setzt die Anzahl an moeglichen Marines |
|---|
| | 173 | * @param marines Die Marinemenge |
|---|
| | 174 | */ |
|---|
| | 175 | public void setMarines(int marines) { |
|---|
| | 176 | this.marines = marines; |
|---|
| | 177 | } |
|---|
| 164 | 178 | |
|---|
| 165 | 179 | public int getDeutFactor() { |
|---|
| r870bccb |
r390f9f1 |
|
| 53 | 53 | private int heat; |
|---|
| 54 | 54 | private int crew; |
|---|
| | 55 | private int marines; |
|---|
| 55 | 56 | private String weapons; |
|---|
| 56 | 57 | @Column(name="maxheat") |
|---|
| … | … | |
| 115 | 116 | return crew; |
|---|
| 116 | 117 | } |
|---|
| | 118 | |
|---|
| | 119 | public int getMarines(){ |
|---|
| | 120 | return marines; |
|---|
| | 121 | } |
|---|
| 117 | 122 | |
|---|
| 118 | 123 | public String getDescrip() { |
|---|