本文整理汇总了Python中ige.IDataHolder.IDataHolder.relation方法的典型用法代码示例。如果您正苦于以下问题:Python IDataHolder.relation方法的具体用法?Python IDataHolder.relation怎么用?Python IDataHolder.relation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ige.IDataHolder.IDataHolder
的用法示例。
在下文中一共展示了IDataHolder.relation方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: XXXgetDiplomacyWith
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import relation [as 别名]
def XXXgetDiplomacyWith(self, tran, obj, playerID):
if obj.oid == playerID:
return REL_UNITY
player = tran.db.get(playerID, None)
if player.type == T_AIEDENPLAYER:
dipl = obj.diplomacyRels.get(playerID, None)
if not dipl:
# make default
dipl = IDataHolder()
dipl.type = T_DIPLREL
dipl.pacts = {
PACT_ALLOW_CIVILIAN_SHIPS: [PACT_ACTIVE, PACT_ALLOW_CIVILIAN_SHIPS],
PACT_ALLOW_MILITARY_SHIPS: [PACT_ACTIVE, PACT_ALLOW_MILITARY_SHIPS]
}
dipl.relation = REL_FRIENDLY
dipl.relChng = 0
dipl.lastContact = tran.db[OID_UNIVERSE].turn
dipl.contactType = CONTACT_NONE
dipl.stats = None
if playerID != obj.oid:
obj.diplomacyRels[playerID] = dipl
else:
log.debug("getDiplomacyWith myself", obj.oid)
return dipl
# this AI battles with overyone
# make default
dipl = IDataHolder()
dipl.type = T_DIPLREL
dipl.pacts = {}
dipl.relation = REL_ENEMY
dipl.relChng = 0
dipl.lastContact = tran.db[OID_UNIVERSE].turn
dipl.contactType = CONTACT_NONE
dipl.stats = None
return dipl
示例2: getDiplomacyWith
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import relation [as 别名]
def getDiplomacyWith(self, tran, obj, playerID):
# this AI battles with overyone
# make default
dipl = IDataHolder()
dipl.type = T_DIPLREL
dipl.pacts = {}
if obj.oid == playerID:
dipl.relation = REL_UNITY
else:
dipl.relation = REL_ENEMY
dipl.relChng = 0
dipl.lastContact = tran.db[OID_UNIVERSE].turn
dipl.contactType = CONTACT_NONE
dipl.stats = None
return dipl
示例3: forceAllyWithEDEN
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import relation [as 别名]
def forceAllyWithEDEN(self,tran,obj):
for partyID in obj.diplomacyRels.keys():
party = tran.db.get(partyID, None)
if party.type == T_AIEDENPLAYER:
diplSelf = obj.diplomacyRels.get(party.oid, None)
log.debug("Allying Pirate with EDEN (forced)", obj.oid, partyID)
diplEDEN = IDataHolder()
diplEDEN.type = T_DIPLREL
diplEDEN.pacts = {
PACT_ALLOW_CIVILIAN_SHIPS: [PACT_ACTIVE, PACT_ALLOW_CIVILIAN_SHIPS],
PACT_ALLOW_MILITARY_SHIPS: [PACT_ACTIVE, PACT_ALLOW_MILITARY_SHIPS]
}
diplEDEN.relation = REL_FRIENDLY
diplEDEN.relChng = 0
diplEDEN.lastContact = tran.db[OID_UNIVERSE].turn
diplEDEN.contactType = CONTACT_STATIC
diplEDEN.stats = None
diplSelf.relation = REL_FRIENDLY
diplSelf.pacts = {
PACT_ALLOW_CIVILIAN_SHIPS: [PACT_ACTIVE, PACT_ALLOW_CIVILIAN_SHIPS],
PACT_ALLOW_MILITARY_SHIPS: [PACT_ACTIVE, PACT_ALLOW_MILITARY_SHIPS]
}
obj.diplomacyRels[party.oid] = diplSelf
party.diplomacyRels[obj.oid] = diplEDEN
示例4: getDiplomacyWith
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import relation [as 别名]
def getDiplomacyWith(contactID):
obj = getPlayer()
dipl = obj.diplomacyRels.get(contactID, None)
if not dipl:
# make default
dipl = IDataHolder()
dipl.type = T_DIPLREL
dipl.pacts = {PACT_ALLOW_CIVILIAN_SHIPS: [PACT_ACTIVE, PACT_ALLOW_CIVILIAN_SHIPS]}
dipl.relation = obj.defaultRelation
dipl.relChng = 0
dipl.lastContact = 0
dipl.stats = None
dipl.contactType = CONTACT_NONE
obj.diplomacyRels[playerID] = dipl
return dipl
示例5: getDiplomacyWith
# 需要导入模块: from ige.IDataHolder import IDataHolder [as 别名]
# 或者: from ige.IDataHolder.IDataHolder import relation [as 别名]
def getDiplomacyWith(self, tran, obj, playerID):
if obj.governorOf:
# player is a governor
leader = tran.db[obj.governorOf]
return self.cmd(leader).getDiplomacyWith(tran, leader, objID)
# player is independent
dipl = obj.diplomacyRels.get(playerID, None)
if not dipl:
# make default
dipl = IDataHolder()
dipl.type = T_DIPLREL
dipl.pacts = {
PACT_ALLOW_CIVILIAN_SHIPS: [PACT_ACTIVE, PACT_ALLOW_CIVILIAN_SHIPS]
}
dipl.relation = obj.defaultRelation
dipl.relChng = 0
dipl.lastContact = tran.db[OID_UNIVERSE].turn
dipl.contactType = CONTACT_NONE
dipl.stats = None
if playerID != obj.oid:
obj.diplomacyRels[playerID] = dipl
else:
log.debug("getDiplomacyWith myself", obj.oid)
return dipl