Reset invicibility timer (#30)

This commit is contained in:
Alula 2022-01-11 15:26:10 +01:00
parent be91851952
commit e27cde67c7
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
3 changed files with 8 additions and 0 deletions

View File

@ -835,6 +835,10 @@ impl GameEntity<&NPCList> for Player {
return Ok(());
}
if state.textscript_vm.reset_invicibility {
self.shock_counter = 0;
}
if self.damage_counter != 0 {
self.damage_counter -= 1;
}

View File

@ -1203,6 +1203,7 @@ impl GameScene {
};
self.player1.tick(state, &self.npc_list)?;
self.player2.tick(state, &self.npc_list)?;
state.textscript_vm.reset_invicibility = false;
if self.player1.damage > 0 {
let xp_loss = self.player1.damage * if self.player1.equip.has_arms_barrier() { 1 } else { 2 };

View File

@ -119,6 +119,7 @@ pub struct TextScriptVM {
/// while parsing no one noticed them.
pub strict_mode: bool,
pub suspend: bool,
pub reset_invicibility: bool,
pub numbers: [u16; 4],
pub face: u16,
pub item: u16,
@ -184,6 +185,7 @@ impl TextScriptVM {
executor_player: TargetPlayer::Player1,
strict_mode: false,
suspend: true,
reset_invicibility: false,
numbers: [0; 4],
face: 0,
item: 0,
@ -253,6 +255,7 @@ impl TextScriptVM {
pub fn start_script(&mut self, event_num: u16) {
self.reset();
self.reset_invicibility = true;
self.state = TextScriptExecutionState::Running(event_num, 0);
log::info!("Started script: #{:04}", event_num);