本文整理汇总了Python中ige.IDataHolder.IDataHolder.name方法的典型用法代码示例。如果您正苦于以下问题:Python IDataHolder.name方法的具体用法?Python IDataHolder.name怎么用?Python IDataHolder.name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ige.IDataHolder.IDataHolder
的用法示例。
在下文中一共展示了IDataHolder.name方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getScanInfos
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def getScanInfos(self, tran, obj, scanPwr, player):
if obj.owner == player.oid:
return []
if scanPwr >= Rules.level1InfoScanPwr:
result = IDataHolder()
result._type = T_SCAN
result.scanPwr = scanPwr
result.oid = obj.oid
result.x = obj.x
result.y = obj.y
result.oldX = obj.oldX
result.oldY = obj.oldY
result.eta = obj.eta
result.signature = obj.signature
result.type = obj.type
result.orbiting = obj.orbiting
if obj.orbiting == OID_NONE and obj.actionIndex < len(obj.actions):
target = obj.actions[obj.actionIndex][1]
targetObj = tran.db[target]
if targetObj.type == T_PLANET:
result.target = targetObj.compOf
else:
result.target = target
else:
return []
if scanPwr >= Rules.level2InfoScanPwr:
result.owner = obj.owner
if obj.customname:
result.name = obj.customname
else:
result.name = obj.name
if scanPwr >= Rules.level3InfoScanPwr:
result.isMilitary = obj.isMilitary
result.combatPwr = obj.combatPwr
if scanPwr >= Rules.level4InfoScanPwr:
# provide less information
result.shipScan = {}
owner = tran.db[obj.owner]
for designID, hp, shield, exp in obj.ships:
tech = owner.shipDesigns[designID]
key = tech.name, tech.combatClass, tech.isMilitary
result.shipScan[key] = result.shipScan.get(key, 0) + 1
if scanPwr >= Rules.partnerScanPwr:
result.scannerPwr = obj.scannerPwr
result.allowmerge = obj.allowmerge
result.customname = obj.customname
result.name = obj.name
return [result]
示例2: getPublicInfo
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def getPublicInfo(self, tran, obj):
result = IDataHolder()
result.oid = obj.oid
result.x = obj.x
result.y = obj.y
result.radius = obj.radius
result.type = obj.type
result.name = obj.name
result.emrLevel = obj.emrLevel
result.scenario = obj.scenario
result.scenarioData = obj.scenarioData
result.timeEnabled = obj.timeEnabled
return result
示例3: getScanInfos
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def getScanInfos(self, tran, obj, scanPwr, player):
if scanPwr >= Rules.level1InfoScanPwr:
result = IDataHolder()
result._type = T_SCAN
result.scanPwr = scanPwr
result.oid = obj.oid
result.signature = obj.signature
result.type = obj.type
result.orbit = obj.orbit
result.compOf = obj.compOf
result.x = obj.x
result.y = obj.y
result.plType = obj.plType
if scanPwr >= Rules.level2InfoScanPwr:
result.plDiameter = obj.plDiameter
if getattr(obj, "plType", 'X') != 'G':
result.plMin = obj.plMin
result.plBio = obj.plBio
result.plEn = obj.plEn
result.plSlots = obj.plSlots
result.plStratRes = obj.plStratRes
result.plMaxSlots = obj.plMaxSlots
if scanPwr >= Rules.level3InfoScanPwr:
result.name = obj.name
result.storPop = obj.storPop
result.owner = obj.owner
#XXX result.plMaxMoonsSlots = obj.plMaxMoonsSlots
if scanPwr >= Rules.level4InfoScanPwr:
# TODO provide less information
result.hasRefuel = (obj.refuelInc > 0) #simple detect if docks exist for problems dialog
result.slots = obj.slots
#XXX result.plMoonsSlots = obj.plMoonsSlots
result.shield = obj.shield
result.prevShield = -1
result.maxShield = -1
if scanPwr >= Rules.partnerScanPwr:
result.maxShield = obj.maxShield
result.prevShield = obj.prevShield
result.refuelMax = obj.refuelMax
result.refuelInc = obj.refuelInc
result.scannerPwr = obj.scannerPwr
result.trainShipInc = obj.trainShipInc
result.trainShipMax = obj.trainShipMax
result.upgradeShip = obj.upgradeShip
result.repairShip = obj.repairShip
result.fleetSpeedBoost = obj.fleetSpeedBoost
return [result]
示例4: getScanInfos
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def getScanInfos(self, tran, obj, scanPwr, player):
result = IDataHolder()
results = [result]
if scanPwr >= Rules.level1InfoScanPwr:
result._type = T_SCAN
result.scanPwr = scanPwr
result.oid = obj.oid
result.x = obj.x
result.y = obj.y
if hasattr(obj, 'destinationOid'):
result.destinationOid = obj.destinationOid
# multiply by 1000 to increase accuracy
#~ result.dist = obj.dist * 1000
#~ result.dAngle = obj.dAngle * 1000
#~ result.sAngle = obj.sAngle * 1000
result.signature = obj.signature
result.type = obj.type
result.compOf = obj.compOf
result.starClass = obj.starClass
if scanPwr >= Rules.level2InfoScanPwr:
result.name = obj.name
result.combatCounter = obj.combatCounter
if scanPwr >= Rules.level3InfoScanPwr:
result.planets = obj.planets
result.owner = obj.owner
for planetID in obj.planets:
planet = tran.db[planetID]
if planet.owner == player: ####### This was player.owner, which made no sense. Hope this change doesn't break something
continue
newPwr = scanPwr * planet.signature / obj.signature
results.extend(self.cmd(planet).getScanInfos(tran, planet, newPwr, player))
if scanPwr >= Rules.level4InfoScanPwr:
result.fleets = obj.fleets
for fleetID in obj.fleets:
fleet = tran.db[fleetID]
if fleet.owner == player:
continue
newPwr = scanPwr * fleet.signature / obj.signature
results.extend(self.cmd(fleet).getScanInfos(tran, fleet, newPwr, player))
result.hasmines = 0 #no
if len(obj.minefield) > 0:
result.hasmines = 1 #yes
result.minefield = self.getMines(obj,player.oid) #only shows mines you own
if len(obj.minefield) > 1 or (len(obj.minefield) == 1 and len(result.minefield) == 0):
result.hasmines = 2 #yes, and some aren't my mines
return results
示例5: makeShipMinSpec
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def makeShipMinSpec(player, name, hullID, eqIDs, improvements,
raiseExs = True):
ship = makeShipFullSpec(player, name, hullID, eqIDs, improvements, raiseExs)
# make 'real' ship spec
spec = IDataHolder()
spec.type = Const.T_SHIP
spec.name = ship.name
spec.hullID = ship.hullID
spec.level = ship.level
spec.eqIDs = ship.eqIDs
spec.improvements = ship.improvements
spec.combatClass = ship.combatClass
spec.signature = ship.signature
spec.scannerPwr = ship.scannerPwr
spec.speed = ship.speed
spec.battleSpeed = ship.battleSpeed
spec.maxHP = ship.maxHP
spec.shieldHP = ship.shieldHP
spec.combatAtt = ship.combatAtt
spec.combatDef = ship.combatDef
spec.missileDef = ship.missileDef
spec.storEn = ship.storEn
spec.operEn = ship.operEn
spec.buildProd = ship.buildProd
spec.buildSRes = ship.buildSRes
spec.weaponIDs = ship.weaponIDs
spec.deployStructs = ship.deployStructs
spec.deployHandlers = ship.deployHandlers
spec.built = 0
spec.buildTurns = 1
spec.upgradeTo = 0
spec.isMilitary = ship.isMilitary
spec.baseExp = ship.baseExp
spec.combatPwr = ship.combatPwr
spec.autoRepairFix = ship.autoRepairFix
spec.autoRepairPerc = ship.autoRepairPerc
spec.shieldRechargeFix = ship.shieldRechargeFix
spec.shieldRechargePerc = ship.shieldRechargePerc
spec.hardShield = ship.hardShield
spec.combatAttMultiplier = ship.combatAttMultiplier
spec.damageAbsorb = ship.damageAbsorb
return spec
示例6: getScanInfos
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def getScanInfos(self, tran, obj, scanPwr, player):
result = IDataHolder()
results = [result]
if scanPwr >= Rules.level1InfoScanPwr:
result._type = Const.T_SCAN
result.scanPwr = scanPwr
result.oid = obj.oid
result.x = obj.x
result.y = obj.y
if hasattr(obj, 'destinationOid'):
result.destinationOid = obj.destinationOid
result.signature = obj.signature
result.type = obj.type
result.compOf = obj.compOf
result.starClass = obj.starClass
if scanPwr >= Rules.level2InfoScanPwr:
result.name = obj.name
result.combatCounter = obj.combatCounter
if scanPwr >= Rules.level3InfoScanPwr:
result.planets = obj.planets
result.owner = obj.owner
for planetID in obj.planets:
planet = tran.db[planetID]
if planet.owner == player: ####### This was player.owner, which made no sense. Hope this change doesn't break something
continue
newPwr = scanPwr * planet.signature / obj.signature
results.extend(self.cmd(planet).getScanInfos(tran, planet, newPwr, player))
if scanPwr >= Rules.level4InfoScanPwr:
result.fleets = obj.fleets
for fleetID in obj.fleets:
fleet = tran.db[fleetID]
if fleet.owner == player:
continue
newPwr = scanPwr * fleet.signature / obj.signature
results.extend(self.cmd(fleet).getScanInfos(tran, fleet, newPwr, player))
result.minefield = self.getMines(obj, player.oid)
ownsMines = 1 if result.minefield else 0
result.hasmines = min(2, len(self.getAllMines(obj))) - ownsMines
return results
示例7: makeShipFullSpec
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import name [as 别名]
def makeShipFullSpec(player, name, hullID, eqIDs, improvements, raiseExs = True):
if not hullID:
raise GameException("Ship's hull must be specified.")
hull = Rules.techs[hullID]
if not hull.isShipHull:
raise GameException("Ship's hull must be specified.")
ship = IDataHolder()
ship.type = Const.T_SHIP
# initial values
hullTechEff = Rules.techImprEff[player.techs.get(hullID, Rules.techBaseImprovement)]
ship.name = name
ship.hullID = hullID
ship.eqIDs = eqIDs
ship.level = hull.level
ship.combatClass = hull.combatClass
ship.improvements = improvements
ship.buildProd = hull.buildProd
ship.buildSRes = copy.copy(hull.buildSRes)
# stats grouped as "Base"
ship.operEn = hull.operEn
ship.storEn = hull.storEn * hullTechEff
ship.weight = hull.weight
ship.slots = 0
ship.scannerPwr = max(hull.scannerPwr * hullTechEff, Rules.scannerMinPwr)
ship.engPwr = 0
ship.engStlPwr = 0
ship.speed = 0.0
ship.battleSpeed = 0.0
# stats grouped as "Signature"
ship.signature = hull.signature
ship.negsignature = 0
ship.minSignature = hull.minSignature
ship.signatureCloak = 1.0
ship.signatureDecloak = 1.0
# stats grouped as "Combat"
ship.combatAttBase = hull.combatAtt * hullTechEff
ship.combatAtt = 0
ship.combatAttMultiplier = 1.0
ship.combatDefBase = hull.combatDef * hullTechEff
ship.combatDef = 0
ship.combatDefMultiplier = 1.0
ship.missileDefBase = hull.missileDef * hullTechEff
ship.missileDef = 0
ship.missileDefMultiplier = 1.0
ship.weaponIDs = []
ship.isMilitary = 0
ship.baseExp = 0
combatExtra = 0
# stats grouped as "Sturdiness"
ship.autoRepairFix = hull.autoRepairFix
ship.autoRepairPerc = hull.autoRepairPerc
ship.shieldRechargeFix = hull.shieldRechargeFix
ship.shieldRechargePerc = hull.shieldRechargePerc
ship.hardShield = 0.0
ship.shieldHP = 0
ship.maxHP = int(hull.maxHP * hullTechEff)
ship.damageAbsorb = 0
shieldPerc = 0.0
# stats grouped as "Deployables"
ship.deployStructs = []
ship.deployHandlers = []
ship.upgradeTo = 0
counter = {}
installations = {}
equipCounter = {}
for techID in eqIDs:
tech = Rules.techs[techID]
techEff = Rules.techImprEff[player.techs.get(techID, Rules.techBaseImprovement)]
if eqIDs[techID] < 0 and raiseExs:
raise GameException("Invalid equipment count (less than 0).")
for i in xrange(0, eqIDs[techID]):
counter[tech.subtype] = 1 + counter.get(tech.subtype, 0)
installations[techID] = 1 + installations.get(techID, 0)
_checkValidity(ship, tech, installations, equipCounter, raiseExs)
# add values
_moduleBase(ship, tech, techEff)
_moduleSignature(ship, tech)
_moduleCombat(ship, tech, techEff, combatExtra)
_moduleSturdiness(ship, tech, techEff, shieldPerc)
_moduleDeployables(ship, tech)
_checkValidityWhole(ship, hull, counter, raiseExs)
_finalizeBase(ship, hull)
_finalizeSignature(ship, hull)
_finalizeCombat(ship)
_finalizeSturdiness(ship, shieldPerc)
_setCombatPower(ship, combatExtra)
return ship