Exemplo n.º 1
0
 def declare_update_data(self, clan_id, current_time):
     self.doc.fort_war_clan_id = clan_id
     self.doc.fort_war_start_time = current_time
     self.doc.fort_war_end_time = current_time + master_battle_field_setting_inst.get_number('battle_field_fort_war_time')
     # 要塞直接更新保护时间
     self.doc.protect_start_time = self.doc.fort_war_end_time
     self.doc.protect_defense_end_time = self.doc.fort_war_end_time + get_block_protect_set_defense_time()
     self.doc.protect_end_time = self.doc.fort_war_end_time + get_block_protect_time(self.doc.block_id)
     self.update()
Exemplo n.º 2
0
 def update_battle_user(self, clan_id, server_user_id, current_time=0):
     self.doc.battle_clan_id = clan_id
     self.doc.battle_server_user_id = server_user_id
     if current_time > 0:
         self.doc.battle_timeout = current_time + master_battle_field_setting_inst.get_number('battle_field_block_battle_max_time')
         # 同时先更新一次保护时间,防止攻击中途没打完退出
         self.doc.protect_start_time = self.doc.battle_timeout
         self.doc.protect_end_time = self.doc.battle_timeout + get_block_protect_time(self.doc.block_id)
     else:
         self.doc.battle_timeout = 0
     self.update()
Exemplo n.º 3
0
 def is_in_frozen_time(self, current_time, block_id=None, point_id=None):
     if point_id:
         # 是进攻的要塞
         # 进攻不同区块 or 同一区块且统一据点, 则需要检查冷却时间
         is_same_step_point = (self.doc.last_attack_block_id >= 0 and self.doc.last_attack_point_id != block_id) or \
                              (point_id == self.doc.last_attack_point_id) or \
                              (point_id in FORT_WAR_STEP2_POINT_ID_LIST and
                               self.doc.last_attack_point_id in FORT_WAR_STEP2_POINT_ID_LIST)
         return is_same_step_point and (
             self.doc.last_attack_time + master_battle_field_setting_inst.
             get_number('battle_field_user_battle_interval') > current_time)
     else:
         # 普通据点
         return self.doc.last_attack_time + master_battle_field_setting_inst.get_number(
             'battle_field_user_battle_interval') > current_time
Exemplo n.º 4
0
 def user_start_battle(self, point_id, server_user_id, current_time):
     self.doc.point_detail_dict[point_id].battle_server_user_id = server_user_id
     self.doc.point_detail_dict[point_id].battle_end_time = current_time + master_battle_field_setting_inst.get_number('battle_field_fort_step2_battle_time_limit')
     self.update()
Exemplo n.º 5
0
def get_block_protect_set_defense_time():
    return master_battle_field_setting_inst.get_number('battle_field_protect_set_defense_time')
Exemplo n.º 6
0
def get_block_protect_time(block_id):
    if is_fort(block_id):
        # 堡垒
        return master_battle_field_setting_inst.get_number('battle_field_protect_time_fort')
    else:
        return master_battle_field_setting_inst.get_number('battle_field_protect_time_normal')