Example #1
0
    def get_detect_info(self, location):
        if not g.techs["Socioanalytics"].done:
            return g.strings["detect_chance_unknown_base"].replace(" ", u"\xA0")

        accurate = g.techs["Advanced Socioanalytics"].done
        detect_modifier = 1 / location.modifiers.get("stealth", 1)
        chance = self.calc_discovery_chance(accurate, detect_modifier)
        detect_template = u"Detection chance: NEWS:\xA0%s  SCIENCE:\xA0%s  COVERT:\xA0%s  PUBLIC:\xA0%s"
        return detect_template % (g.to_percent(chance.get("news", 0)),
                                  g.to_percent(chance.get("science", 0)),
                                  g.to_percent(chance.get("covert", 0)),
                                  g.to_percent(chance.get("public", 0)))
Example #2
0
    def get_detect_info(self, location):
        if not g.techs["Socioanalytics"].done:
            return g.strings["detect_chance_unknown_base"].replace(
                " ", u"\xA0")

        accurate = g.techs["Advanced Socioanalytics"].done
        detect_modifier = 1 / location.modifiers.get("stealth", 1)
        chance = self.calc_discovery_chance(accurate, detect_modifier)
        detect_template = u"Detection chance: NEWS:\xA0%s  SCIENCE:\xA0%s  COVERT:\xA0%s  PUBLIC:\xA0%s"
        return detect_template % (g.to_percent(chance.get(
            "news", 0)), g.to_percent(
                chance.get("science", 0)), g.to_percent(chance.get(
                    "covert", 0)), g.to_percent(chance.get("public", 0)))
Example #3
0
def get_detect_info(detect_chance):
    detect_template = _("Detection chance:") + "\n"
    chances = []
    
    for group in g.pl.groups.itervalues():
        detect_template += group.name + u":\xA0%s\n"
        chances.append(detect_chance.get(group.type.id, 0))

    if g.pl.display_discover == "full":
        return detect_template % tuple(g.to_percent(c) for c in chances)
    elif g.pl.display_discover == "partial":                                 
        return detect_template % tuple(g.to_percent(g.nearest_percent(c, 25)) for c in chances)                               
    else:              
        return detect_template % tuple(g.danger_level_to_detect_str(detect_chance_to_danger_level(c)) 
                                       for c in chances)
Example #4
0
    def get_quality_info(self):
        bonus_text = ""

        if self.item_type == cpu_type:
            bonus_text += _("CPU per day:") + " "
            bonus_text += g.add_commas(self.item_qual)
        elif self.item_type == reactor_type:
            bonus_text += _("Detection chance reduction:") + " "
            bonus_text += g.to_percent(self.item_qual)
        elif self.item_type == network_type:
            bonus_text += _("CPU bonus:") + " "
            bonus_text += g.to_percent(self.item_qual)
        elif self.item_type == security_type:
            bonus_text += _("Detection chance reduction:") + " "
            bonus_text += g.to_percent(self.item_qual)

        return bonus_text
Example #5
0
    def get_detect_info(self, location):
        if g.pl.display_discover == "none":
            return g.strings["detect_chance_unknown_base"].replace(
                " ", u"\xA0")

        accurate = bool(g.pl.display_discover == "full")
        detect_modifier = 1 / location.modifiers.get("stealth", 1)
        chance = self.calc_discovery_chance(accurate, detect_modifier)
        detect_template = _("Detection chance:") + "\n" + \
                          _("NEWS")    + u":\xA0%s\n"   + \
                          _("SCIENCE") + u":\xA0%s\n"   + \
                          _("COVERT")  + u":\xA0%s\n"   + \
                          _("PUBLIC")  + u":\xA0%s"
        return detect_template % (g.to_percent(chance.get(
            "news", 0)), g.to_percent(
                chance.get("science", 0)), g.to_percent(chance.get(
                    "covert", 0)), g.to_percent(chance.get("public", 0)))
Example #6
0
    def get_quality_info(self):
        bonus_text = ""
        
        if self.item_type.id == "cpu":
            bonus_text += _("CPU per day:")+" "
            bonus_text += g.add_commas(self.item_qual)
        elif self.item_type.id == reactor_type:
            bonus_text += _("Detection chance reduction:")+" "
            bonus_text += g.to_percent(self.item_qual)
        elif self.item_type.id == "network":
            bonus_text += _("CPU bonus:")+" "
            bonus_text += g.to_percent(self.item_qual)
        elif self.item_type.id == "security":
            bonus_text += _("Detection chance reduction:")+" "
            bonus_text += g.to_percent(self.item_qual)

        return bonus_text
Example #7
0
def get_detect_info(detect_chance):
    detect_template = _("Detection chance:") + "\n" + \
                      _("NEWS")    + u":\xA0%s\n"   + \
                      _("SCIENCE") + u":\xA0%s\n"   + \
                      _("COVERT")  + u":\xA0%s\n"   + \
                      _("PUBLIC")  + u":\xA0%s"
                      
    chances = (detect_chance.get("news", 0),
               detect_chance.get("science", 0),
               detect_chance.get("covert", 0),
               detect_chance.get("public", 0))

    if g.pl.display_discover == "full":
        return detect_template % tuple(g.to_percent(c) for c in chances)
    elif g.pl.display_discover == "partial":                                 
        return detect_template % tuple(g.to_percent(g.nearest_percent(c, 25)) for c in chances)                               
    else:              
        return detect_template % tuple(g.danger_level_to_detect_str(detect_chance_to_danger_level(c)) 
                                       for c in chances)