public void StartSingularity(int initialDamage, int incrementialDamage) { ShipAbility ability = ShipAbility.SINGULARITY; if (PlayerController.Locked == null || PlayerController.Locked.MovementAssembly.ActualPosition() .DistanceTo(PlayerController.MovementAssembly.ActualPosition()) > 600) { return; } PlayerController.Account.Cooldown.AbilityCooldown.TryGetValue(ability.ID, out DateTime lastAbilityTime); if (!_singularityActive && lastAbilityTime.FromNow() > ability.Duration + ability.Cooldown) { _singularityActive = true; PlayerController.Account.Cooldown.AbilityCooldown[ability.ID] = DateTime.Now; PlayerController.EffectsAssembly.ActivateSingularity(); PlayerController.Locked.EffectsAssembly.ActivateSingularity(); _singularityLastDamage = initialDamage; _singularityDamageIncrease = incrementialDamage; _singularityCounter = 1; PlayerController.Send(PacketBuilder.Slotbar.ItemCooldownCommand(ability.Name, ability.Duration.TotalMilliseconds)); } }
Sprite GetIcon(ShipAbility ability) { AbilityIcon abIcon = abilityIcons.Where(a => a.ability == ability).FirstOrDefault(); if (abIcon != null) { return(abIcon.Icon); } return(null); }
public void CheckOrStopSingularity(bool force = false) { try { ShipAbility ability = ShipAbility.SINGULARITY; PlayerController.Account.Cooldown.AbilityCooldown.TryGetValue(ability.ID, out DateTime lastAbilityTime); if (_singularityActive && (_singularityCounter == (int)ability.Duration.TotalSeconds * 2 || force)) { _singularityActive = false; PlayerController.Account.Cooldown.AbilityCooldown[ability.ID] = DateTime.Now - ability.Duration; PlayerController.EffectsAssembly.DeactivateSingularity(); PlayerController.Locked.EffectsAssembly.DeactivateSingularity(); PlayerController.Send(PacketBuilder.Slotbar.ItemCooldownCommand(ability.Name, ability.Cooldown.TotalMilliseconds)); } else if (_singularityActive) { if (++_singularityCounter % 2 == 0) { if (PlayerController.Locked.EffectsAssembly.HasProtection || (PlayerController.Locked is PlayerController lockedPlayerController && lockedPlayerController.SpecialItemsAssembly.IsInvicible)) { PlayerController.Locked.AttackTraceAssembly.LogAttack(PlayerController, 0, 0, false); ICommand missCommand = new AttackMissedCommand(new AttackTypeModule(AttackTypeModule.SINGULARITY), PlayerController.Locked.ID, 0); PlayerController.Locked.Send(new AttackMissedCommand(new AttackTypeModule(AttackTypeModule.SINGULARITY), PlayerController.Locked.ID, 1)); PlayerController.Locked.EntitiesLocked(x => x.Send(missCommand)); } else { PlayerController.Locked.HangarAssembly.ChangeHitpoints(-_singularityLastDamage, false); PlayerController.Locked.AttackTraceAssembly.LogAttack(PlayerController, 0, _singularityLastDamage, false); PlayerController.Locked.HangarAssembly.CheckDeath(); ICommand damageCommand = PacketBuilder.AttackCommand(PlayerController, PlayerController.Locked, AttackTypeModule.SINGULARITY, _singularityLastDamage); PlayerController.Locked.Send(damageCommand); // send to player PlayerController.Locked.EntitiesLocked(y => y.Send(damageCommand)); // send to all who have him in lock } _singularityLastDamage += _singularityDamageIncrease; } } } catch { }
private bool IsActive(ShipAbility ability) { PlayerController.Account.Cooldown.AbilityCooldown.TryGetValue(ability.ID, out DateTime lastAbilityTime); return(lastAbilityTime.FromNow() < ability.Duration); }
private void Start() { shipAbility = GetComponent <ShipAbility>(); SetPlayerAbility(); inputManager = GetComponent <InputManager>(); }