GPN13:Rocket Scissor Spacegoo: Unterschied zwischen den Versionen

aus dem Wiki des Entropia e.V., CCC Karlsruhe
Wechseln zu: Navigation, Suche
Zeile 3: Zeile 3:
 
[[Datei:spacegoo_02_kampfsystem.png|thumb|300px]]
 
[[Datei:spacegoo_02_kampfsystem.png|thumb|300px]]
  
'''http://spacegoo.gpn.entropia.de'''
 
  
'''spacegoo.gpn.entropia.de'''
+
==Server==
 +
mehr doku und '''http://spacegoo.gpn.entropia.de'''
 +
 
 +
'''spacegoo.gpn.entropia.de:6000'''
 +
 
 +
==Code fürs Kampfsystem==
 +
 
 +
 
 +
def battle_round(attacker,defender):
 +
    #nur eine asymmetrische runde. das hier muss mal also zweimal aufrufen.
 +
    numships = len(attacker)
 +
    defender = defender[::]
 +
    for def_type in range(0,numships):
 +
        for att_type in range(0,numships):
 +
            multiplier = 0.1
 +
            absolute = 1
 +
            if (def_type-att_type)%numships == 1:
 +
                multiplier = 0.25
 +
                absolute = 2
 +
            if (def_type-att_type)%numships == numships-1:
 +
                multiplier = 0.01
 +
            defender[def_type] -= (attacker[att_type]*multiplier) + (attacker[att_type] > 0) * absolute
 +
        defender[def_type] = max(0,defender[def_type])
 +
    return defender
 +
 
 +
def battle(s1,s2):
 +
    ships1 = s1[::]
 +
    ships2 = s2[::]
 +
    while sum(ships1) > 0 and sum(ships2) >0:
 +
        new1 = battle_round(ships2,ships1)
 +
        ships2 = battle_round(ships1,ships2)
 +
        ships1 = new1
 +
        #print ships1,ships2
 +
       
 +
    ships1 = map(int,ships1)
 +
    ships2 = map(int,ships2)
 +
    #print ships1,ships2
 +
    return ships1, ships2
 +
 
  
  

Version vom 30. Mai 2013, 20:50 Uhr

Spacegoo 01 prinzip.png
Spacegoo 02 kampfsystem.png


Server

mehr doku und http://spacegoo.gpn.entropia.de

spacegoo.gpn.entropia.de:6000

Code fürs Kampfsystem

def battle_round(attacker,defender):
   #nur eine asymmetrische runde. das hier muss mal also zweimal aufrufen.
   numships = len(attacker)
   defender = defender[::]
   for def_type in range(0,numships):
       for att_type in range(0,numships):
           multiplier = 0.1
           absolute = 1
           if (def_type-att_type)%numships == 1:
               multiplier = 0.25
               absolute = 2
           if (def_type-att_type)%numships == numships-1:
               multiplier = 0.01
           defender[def_type] -= (attacker[att_type]*multiplier) + (attacker[att_type] > 0) * absolute
       defender[def_type] = max(0,defender[def_type])
   return defender
def battle(s1,s2):
   ships1 = s1[::]
   ships2 = s2[::]
   while sum(ships1) > 0 and sum(ships2) >0:
       new1 = battle_round(ships2,ships1)
       ships2 = battle_round(ships1,ships2)
       ships1 = new1
       #print ships1,ships2
       
   ships1 = map(int,ships1)
   ships2 = map(int,ships2)
   #print ships1,ships2
   return ships1, ships2