private async Task PlayerDisembark(Direction dir) { Player.BoardedRaft = null; await Map.PlayerCursorMovement(dir); SoundMan.StopSound(LotaSound.Raft1); }
private async Task AttackGuard(Guard guard, int distance) { if (guard.OnPlayerAttack != null) { bool cancel = await guard.OnPlayerAttack(GameState, guard); if (cancel) { return; } } double hitChance = ChanceToHitGuard(guard, distance); if (Random.NextDouble() > hitChance) { await TextArea.PrintLine("Attack on " + guard.Name + " missed", XleColor.Purple); SoundMan.PlaySound(LotaSound.PlayerMiss); } else { int dam = RollDamageToGuard(guard); IsAngry = true; Player.LastAttackedMapID = TheMap.MapID; await TextArea.Print(guard.Name + " struck ", XleColor.Yellow); await TextArea.Print(dam.ToString(), XleColor.White); await TextArea.Print(" H.P. Blow", XleColor.White); await TextArea.PrintLine(); guard.HP -= dam; SoundMan.PlaySound(LotaSound.PlayerHit); if (guard.HP <= 0) { await TextArea.PrintLine(guard.Name + " killed"); TheMap.Guards.Remove(guard); await GameControl.WaitAsync(100); SoundMan.StopSound(LotaSound.PlayerHit); SoundMan.PlaySound(LotaSound.EnemyDie); await(guard.OnGuardDead?.Invoke(GameState, guard) ?? Task.FromResult(false)); } } }
public override Task KeyPress(Keys keyCode, string keyString) { SoundMan.StopSound(LotaSound.Music); return(base.KeyPress(keyCode, keyString)); }