public void openingChest() { if (Closed) { NonAnimationSoundEvent openedChestSoundEvent = new NonAnimationSoundEvent(openSound); LocalServer.SendToClients(openedChestSoundEvent); spriteAssetName = openContainerSprite; } }
public override bool OnServerReceive(LocalServer server) { player.AddStatPoint(stat); NonAnimationSoundEvent statSoundEvent = new NonAnimationSoundEvent("Sounds/CLICK10A", true, player.Id); LocalServer.SendToClients(statSoundEvent); LocalServer.SendToClients(new LevelChangedEvent(new List <GameObject> { player })); return(true); }
protected override void DoAction(LocalServer server, HashSet <GameObject> changedObjects) { door.Sprite.SheetIndex = (door.Sprite.SheetIndex + 1) % 2; door.Open(); AddVisibleTiles(server.Level, changedObjects); player.ComputeVisibility(); AddVisibleTiles(server.Level, changedObjects); changedObjects.Add(door); NonAnimationSoundEvent DoorSoundEvent = new NonAnimationSoundEvent("Sounds/door-1-open"); LocalServer.SendToClients(DoorSoundEvent); }
public override void DoSkill(Living caster, Living livingTarget, Tile TileTarget) { if (livingTarget != null) { caster.Mana -= ManaCost; NonAnimationSoundEvent MagicBoldSound = new NonAnimationSoundEvent("Sounds/donnerre2"); LocalServer.SendToClients(MagicBoldSound); livingTarget.TakeDamage(skillPower, DamageType.Magic); } else { throw new Exception("invalid target"); } }
public override bool OnServerReceive(LocalServer server) { if (player.CurrentSkill != newSelectedSkill) { player.CurrentSkill = newSelectedSkill; } else { player.CurrentSkill = null; } NonAnimationSoundEvent selectSkillSound = new NonAnimationSoundEvent("Sounds/CLICK14A", true, player.Id); LocalServer.SendToClients(selectSkillSound); return(true); }
/// <summary> /// Adds exp to the players current exp. Can be a flat value or calculated based on the killed enemy his "power" /// </summary> /// <param name="expGained"></param> /// <param name="killedEnemy"></param> public void ReceiveExp(int expGained, Enemy killedEnemy = null) { if (killedEnemy != null) { int expmod = 50; float diffulcityMod = killedEnemy.statAverige / statAverige; expGained = (int)(diffulcityMod * expmod); } exp += expGained; while (exp >= RequiredExperience()) { LevelUp(); NonAnimationSoundEvent LevelUpSound = new NonAnimationSoundEvent("Sounds/Taiko_Drum_1", true, Id); LocalServer.SendToClients(LevelUpSound); } }
protected override void DoAction(LocalServer server, HashSet <GameObject> changedObjects) { potion.stackCount--; switch (potion.GetPotionType) { case PotionType.Health: player.Health += potion.PotionValue; NonAnimationSoundEvent PotionSoundEvent = new NonAnimationSoundEvent("Sounds/Potion Sound smaller"); LocalServer.SendToClients(PotionSoundEvent); break; case PotionType.Mana: player.Mana += potion.PotionValue; NonAnimationSoundEvent PotionSoundEvent2 = new NonAnimationSoundEvent("Sounds/Potion Sound smaller"); LocalServer.SendToClients(PotionSoundEvent2); break; default: throw new Exception("invalid potionType"); } changedObjects.Add(potion); }
public override bool OnServerReceive(LocalServer server) { List <GameObject> changed = new List <GameObject>(); if (item != null) { changed.Add(item); } if (player.MouseSlot.Item != null) { changed.Add(player.MouseSlot.Item); } changed.Add(target); changed.Add(player.MouseSlot); changed.Add(player);//needed for skill slots player.MouseSlot.AddTo(item, target); NonAnimationSoundEvent pickupSound = new NonAnimationSoundEvent("Sounds/CLICK10B", true, player.Id); LocalServer.SendToClients(new LevelChangedEvent(changed)); return(true); }
/// <summary> /// Handles attacking an opponent. First checks if attacker hits opponent, if succesfull sends attackvalue to defending side, if unsuccesfull displays miss feedback /// </summary> /// <param name="target"></param> public void Attack(Living target) { string hitSound = "Sounds/muted_metallic_crash_impact"; int damageDealt = 0; DamageType damageType = DamageType.Physical; if (Weapon.SlotItem != null) { WeaponEquipment weaponItem = Weapon.SlotItem as WeaponEquipment; damageType = weaponItem.GetDamageType; hitSound = weaponItem.HitSound; } //double hitNumber = GameEnvironment.Random.NextDouble(); //if (hitNumber < HitChance()) if (TryHit(target)) { double attackValue = AttackValue(); NonAnimationSoundEvent hitSoundEvent = new NonAnimationSoundEvent(hitSound); //no annimation for attacks (hit or miss) yet. when inplementing that, include sound effect there and remove this. LocalServer.SendToClients(hitSoundEvent); damageDealt = target.TakeDamage(attackValue, damageType); } else { //TODO: Display attack missed (visual feedback on fail) NonAnimationSoundEvent missSoundEvent = new NonAnimationSoundEvent("Sounds/Dodge"); //no annimation for attacks (hit or miss) yet. when inplementing that, include sound effect there and remove this. LocalServer.SendToClients(missSoundEvent); } if (damageDealt > 0) { ProcessReflection(damageDealt, target); } }
public override bool OnServerReceive(LocalServer server) { NonAnimationSoundEvent nextLevelSound = new NonAnimationSoundEvent("Sounds/wooden-stairs-1"); LocalServer.SendToClients(nextLevelSound); Level level = new Level(server.LevelIndex + 1); List <GameObject> playerlist = server.Level.FindAll(obj => obj is Player); for (int p = 1; p <= playerlist.Count; p++) { Player player = playerlist[p - 1] as Player; (level.Find("StartTile" + p) as Tile).PutOnTile(player); player.ActionPoints = Player.MaxActionPoints; } foreach (Player p in playerlist) { p.ComputeVisibility(); } server.Level = level; LocalServer.SendToClients(new LevelUpdatedEvent(level)); return(true); }