def __init__(self, pUnit): self.pUnit = pUnit # unit type self.UnitType = pUnit.getUnitType() self.Owner = pUnit.getOwner() self.isSelected = pUnit.IsSelected() self.isFortified = pUnit.getTeam() != gc.getGame().getActiveTeam() or pUnit.isWaiting() self.isMoved = pUnit.canMove() and pUnit.hasMoved() self.isMove = pUnit.canMove() and not pUnit.hasMoved() self.isNotMove = not pUnit.canMove() self.isHurt = pUnit.isHurt() self.isPromotionReady = pUnit.isPromotionReady() iLeaderPromo = gc.getInfoTypeForString('PROMOTION_LEADER') self.isLeadByGreatGeneral = iLeaderPromo != -1 and pUnit.isHasPromotion(iLeaderPromo) self.DotStatus = self._getDotStatus() self.Mission = self._getMission(pUnit) if PleOpt.isShowUpgradeIndicator(): self.isCanUpgrade = mt.checkAnyUpgrade(pUnit) else: self.isCanUpgrade = False # health self.currHitPoints = pUnit.currHitPoints() self.maxHitPoints = pUnit.maxHitPoints() if (pUnit.isFighting()): self.isShowHealth = False elif (pUnit.getDomainType() == DomainTypes.DOMAIN_AIR): self.isShowHealth = pUnit.canAirAttack() else: self.isShowHealth = pUnit.canFight()
def __init__(self, pUnit): self.bSelected = pUnit.IsSelected() self.eUnit = pUnit.getUnitType() self.sDotState, self.iDotxSize, self.iDotySize, self.iDotxOffset, self.iDotyOffset = _getDOTInfo(pUnit) self.sMission = _getMission(pUnit) self.bPromo = pUnit.isPromotionReady() self.bGG = iLeaderPromo != -1 and pUnit.isHasPromotion(iLeaderPromo) self.bUpgrade = mt.checkAnyUpgrade(pUnit) self.icurrHitPoints = pUnit.currHitPoints() self.imaxHitPoints = pUnit.maxHitPoints() self.iMovesLeft = pUnit.movesLeft() self.iMoves = pUnit.getMoves()
def setScore(self, value): # <advc.085> # Set the contact widget explicitly for Score and Name (no longer the default) widgetData = None if gc.getPlayer(self._currPlayerScore.getID()).isAlive(): widgetData = self._getContactWidget() # Score breakdown when hovering over the active player's score (no longer provided by WIDGET_CONTACT_CIV) -- or anyone's score in Debug mode w/ Ctrl pressed. if self._activePlayer == self._currPlayerScore.getID() or ( gc.getGame().isDebugMode() and MonkeyTools.bCtrl()): widgetData = (WidgetTypes.WIDGET_SCORE_BREAKDOWN, self._currPlayerScore.getID(), 0) # </advc.085> self._set(SCORE, smallText(value), widgetData)