protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adds high effect
            character.ServerAddStatusEffect <StatusEffectHigh>(intensity: 0.7);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #2
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove toxins
            character.ServerRemoveStatusEffectIntensity <StatusEffectToxins>(intensityToRemove: 0.3);

            base.ServerOnUse(character, currentStats);
        }
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // add psi protection
            character.ServerAddStatusEffect <StatusEffectProtectionPsi>(intensity: 0.5); // 5 minutes

            base.ServerOnUse(character, currentStats);
        }
        protected virtual void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            if (this.MedicalToxicity > 0)
            {
                character.ServerAddStatusEffect <StatusEffectMedicineOveruse>(intensity: this.MedicalToxicity);
            }

            if (this.StaminaRestore != 0)
            {
                currentStats.SharedSetStaminaCurrent(currentStats.StaminaCurrent + this.StaminaRestore);
            }

            if (this.HealthRestore != 0)
            {
                currentStats.ServerSetHealthCurrent(currentStats.HealthCurrent + this.HealthRestore);
            }

            if (this.FoodRestore != 0)
            {
                currentStats.ServerSetFoodCurrent(currentStats.FoodCurrent + this.FoodRestore);
            }

            if (this.WaterRestore != 0)
            {
                currentStats.ServerSetWaterCurrent(currentStats.WaterCurrent + this.WaterRestore);
            }
        }
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove mutation (100%)
            character.ServerRemoveStatusEffectIntensity <StatusEffectMutation>(intensityToRemove: 1.0);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #6
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            character.ServerAddStatusEffect <StatusEffectEnergyRush>(intensity: 0.05); // 30 seconds
            character.ServerAddStatusEffect <StatusEffectToxins>(intensity: 0.1);      // 30 seconds

            base.ServerOnUse(character, currentStats);
        }
Beispiel #7
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove radiation
            character.ServerRemoveStatusEffectIntensity <StatusEffectRadiationPoisoning>(intensityToRemove: 0.3);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #8
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove nausea
            character.ServerRemoveStatusEffectIntensity <StatusEffectNausea>(intensityToRemove: 1);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #9
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adds health regeneration
            character.ServerAddStatusEffect <StatusEffectHealingFast>(intensity: 0.4); // 4 seconds (+10hp each second)

            base.ServerOnUse(character, currentStats);
        }
Beispiel #10
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            character.ServerRemoveStatusEffectIntensity <StatusEffectRadiationPoisoning>(
                intensityToRemove: 0.05);                                                              // 30 sec
            character.ServerRemoveStatusEffectIntensity <StatusEffectToxins>(intensityToRemove: 0.05); // 30 sec

            base.ServerOnUse(character, currentStats);
        }
Beispiel #11
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            var technologies = character.SharedGetTechnologies();

            technologies.ServerResetTechTreeAndRefundLearningPoints();
            technologies.IsTechTreeChanged = false;

            serverLastItemUseTimeByCharacter[character] = Server.Game.FrameTime;
        }
Beispiel #12
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove radiation
            character.ServerRemoveStatusEffectIntensity <StatusEffectRadiationPoisoning>(intensityToRemove: 0.1);

            // add radiation protection
            character.ServerAddStatusEffect <StatusEffectProtectionRadiation>(intensity: 0.5); // 5 minutes

            base.ServerOnUse(character, currentStats);
        }
Beispiel #13
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove all bleeding
            character.ServerRemoveStatusEffectIntensity <StatusEffectBleeding>(intensityToRemove: 1);

            //add bleeding protection
            character.ServerAddStatusEffect <StatusEffectProtectionBleeding>(intensity: 0.25); // 2.5 minutes

            base.ServerOnUse(character, currentStats);
        }
Beispiel #14
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove broken leg
            character.ServerRemoveStatusEffectIntensity <StatusEffectBrokenLeg>(intensityToRemove: 1);

            //add splinted leg
            character.ServerAddStatusEffect <StatusEffectSplintedLeg>(intensity: 1);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #15
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adds health regeneration
            character.ServerAddStatusEffect <StatusEffectHealingSlow>(intensity: 0.35); // 35 seconds

            // removes nausea
            character.ServerRemoveStatusEffectIntensity <StatusEffectNausea>(intensityToRemove: 1);

            base.ServerOnUse(character, currentStats);
        }
        private static bool ServerCanRespawn(PlayerCharacterCurrentStats stats, ICharacter character)
        {
            if (stats.HealthCurrent <= 0)
            {
                return(true);
            }

            Logger.Warning($"Cannot respawn {character} - character is not dead: HP={stats.HealthCurrent:F1}");
            return(false);
        }
Beispiel #17
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove toxins
            character.ServerRemoveStatusEffectIntensity <StatusEffectToxins>(intensityToRemove: 0.1);

            //add toxin protection
            character.ServerAddStatusEffect <StatusEffectProtectionToxins>(intensity: 0.5); // 5 minutes

            base.ServerOnUse(character, currentStats);
        }
Beispiel #18
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove some bleeding
            character.ServerRemoveStatusEffectIntensity <StatusEffectBleeding>(intensityToRemove: 0.3); // 3 minutes

            // add small healing effect
            character.ServerAddStatusEffect <StatusEffectHealingSlow>(intensity: 0.10); // 10 seconds (10hp)

            base.ServerOnUse(character, currentStats);
        }
Beispiel #19
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // remove all pain
            character.ServerRemoveStatusEffectIntensity <StatusEffectPain>(intensityToRemove: 1);

            // add pain blocking
            character.ServerAddStatusEffect <StatusEffectProtectionPain>(intensity: 0.5); // 5 minutes

            base.ServerOnUse(character, currentStats);
        }
Beispiel #20
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // decrease overdose level
            character.ServerRemoveStatusEffectIntensity<StatusEffectMedicineOveruse>(intensityToRemove: 1);

            // prevent usage more than once in 10 minutes
            character.ServerAddStatusEffect<StatusEffectAnalBlockage>(intensity: 1);

            base.ServerOnUse(character, currentStats);
        }
Beispiel #21
0
 public ItemEatData(
     IItem item,
     ICharacter character,
     PlayerCharacterCurrentStats currentStats,
     ItemFreshness freshness)
 {
     this.Item         = item;
     this.Character    = character;
     this.CurrentStats = currentStats;
     this.Freshness    = freshness;
 }
Beispiel #22
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adding LP
            var technologies = character.SharedGetTechnologies();

            technologies.ServerAddLearningPoints(UsageGivesLearningPointsAmount
                                                 * TechConstants.ServerLearningPointsGainMultiplier,
                                                 allowModifyingByStatsAndRates: false);

            // notify player
            this.CallClient(character, _ => _.ClientRemote_DisplayUseNotification());

            base.ServerOnUse(character, currentStats);
        }
Beispiel #23
0
        protected override bool SharedCanUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // does the player even have meds overuse?
            if (!character.SharedHasStatusEffect<StatusEffectMedicineOveruse>())
            {
                if (IsClient)
                {
                    NotificationSystem.ClientShowNotification(
                        NotificationNoMedicineOveruse_Title,
                        NotificationNoMedicineOveruse_Message,
                        NotificationColor.Bad,
                        icon: this.Icon);
                }

                return false;
            }

            // does the player have anal blockage?
            if (character.SharedHasStatusEffect<StatusEffectAnalBlockage>())
            {
                if (IsClient)
                {
                    NotificationSystem.ClientShowNotification(
                        NotificationTooMuch_Title,
                        NotificationTooMuch_Message,
                        NotificationColor.Bad,
                        icon: this.Icon);
                }

                return false;
            }

            // does the player have pants equipped?
            if (ItemsContainerCharacterEquipment.HasLegsOrFullBodyEquipment(character))
            {
                if (IsClient)
                {
                    NotificationSystem.ClientShowNotification(
                        NotificationRemovePants_Title,
                        NotificationRemovePants_Message,
                        NotificationColor.Bad,
                        icon: this.Icon);
                }

                return false;
            }

            return true;
        }
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adding LP
            var technologies = character.SharedGetTechnologies();

            technologies.ServerAddLearningPoints(UsageGivesLearningPointsAmount);

            // add pain
            character.ServerAddStatusEffect <StatusEffectPain>(intensity: 1.0); // max

            // notify player
            this.CallClient(character, _ => _.ClientRemote_DisplayUseNotification());

            base.ServerOnUse(character, currentStats);
        }
Beispiel #25
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            var createItemResult = this.droplist.TryDropToCharacterOrGround(character,
                                                                            character.TilePosition,
                                                                            new DropItemContext(character),
                                                                            out _);

            if (!createItemResult.IsEverythingCreated)
            {
                createItemResult.Rollback();
                throw new Exception("Not enough space");
            }

            NotificationSystem.ServerSendItemsNotification(character, createItemResult);
        }
Beispiel #26
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adding LP
            var technologies = character.SharedGetTechnologies();
            var lpReceived   = (uint)Math.Min(
                Math.Round(UsageGivesLearningPointsAmount
                           * TechConstants.ServerLearningPointsGainMultiplier,
                           MidpointRounding.AwayFromZero),
                uint.MaxValue);

            technologies.ServerAddLearningPoints(lpReceived,
                                                 allowModifyingByStatsAndRates: false);

            // notify player
            this.CallClient(character, _ => _.ClientRemote_DisplayUseNotification(lpReceived));

            base.ServerOnUse(character, currentStats);
        }
Beispiel #27
0
        protected override bool SharedCanUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // does the player even have nausea?
            if (character.SharedHasStatusEffect <StatusEffectNausea>())
            {
                return(true);
            }

            if (IsClient)
            {
                NotificationSystem.ClientShowNotification(
                    NotificationNoNausea_Title,
                    NotificationNoNausea_Message,
                    NotificationColor.Bad,
                    icon: this.Icon);
            }

            return(false);
        }
Beispiel #28
0
        protected override void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            // adds health regeneration
            character.ServerAddStatusEffect <StatusEffectHealingSlow>(intensity: 0.75); // 75 seconds (75hp)

            // removes bleeding
            character.ServerRemoveStatusEffectIntensity <StatusEffectBleeding>(intensityToRemove: 1);

            // removes nausea
            character.ServerRemoveStatusEffectIntensity <StatusEffectNausea>(intensityToRemove: 1);

            // checks if the player has a broken leg and if so - fixes it too
            if (character.SharedHasStatusEffect <StatusEffectBrokenLeg>())
            {
                character.ServerRemoveStatusEffectIntensity <StatusEffectBrokenLeg>(intensityToRemove: 1);
                character.ServerAddStatusEffect <StatusEffectSplintedLeg>(intensity: 1);
            }

            base.ServerOnUse(character, currentStats);
        }
        private static void ServerOnSuccessfulRespawn(PlayerCharacterCurrentStats stats, ICharacter character)
        {
            stats.ServerSetHealthCurrent(stats.HealthMax / 2f, overrideDeath: true);
            stats.SharedSetStaminaCurrent(stats.StaminaMax / 2f);
            stats.ServerSetFoodCurrent(stats.FoodMax / 4f);
            stats.ServerSetWaterCurrent(stats.WaterMax / 4f);

            // remove status effects flagged as removed on respawn
            foreach (var statusEffect in character.ServerEnumerateCurrentStatusEffects().ToList())
            {
                var protoStatusEffect = (IProtoStatusEffect)statusEffect.ProtoLogicObject;
                if (protoStatusEffect.IsRemovedOnRespawn)
                {
                    character.ServerRemoveStatusEffect(protoStatusEffect);
                }
            }

            // reset learning points
            var technologies = character.SharedGetTechnologies();

            technologies.ServerResetLearningPointsRemainder();

            var learningPointsRetainedAfterDeath = SharedGetLearningPointsRetainedAfterDeath(character);
            var lostLp = technologies.LearningPoints - learningPointsRetainedAfterDeath;

            if (lostLp > 0)
            {
                technologies.ServerSetLearningPoints(learningPointsRetainedAfterDeath);
                character.ServerAddSkillExperience <SkillLearning>(
                    lostLp * SkillLearning.ExperienceAddedPerLPLost);
            }

            // recreate physics (as dead character doesn't have any physics)
            character.ProtoCharacter.SharedCreatePhysics(character);

            Api.Server.Characters.SetViewScopeMode(character, isEnabled: true);

            // character is weakened after respawn for some time
            character.ServerAddStatusEffect <StatusEffectWeakened>(intensity: 0.5);
        }
Beispiel #30
0
        protected virtual void ServerOnUse(ICharacter character, PlayerCharacterCurrentStats currentStats)
        {
            if (this.MedicalToxicity > 0)
            {
                character.ServerAddStatusEffect <StatusEffectMedicineOveruse>(intensity: this.MedicalToxicity);
            }

            if (this.StaminaRestore != 0)
            {
                currentStats.SharedSetStaminaCurrent(currentStats.StaminaCurrent + this.StaminaRestore);
            }

            if (this.HealthRestore != 0)
            {
                if (this.HealthRestore > 0)
                {
                    currentStats.ServerSetHealthCurrent(currentStats.HealthCurrent + this.HealthRestore);
                }
                else
                {
                    currentStats.ServerReduceHealth(-this.HealthRestore, this);
                }
            }

            if (this.FoodRestore != 0)
            {
                currentStats.ServerSetFoodCurrent(currentStats.FoodCurrent + this.FoodRestore);
            }

            if (this.WaterRestore != 0)
            {
                currentStats.ServerSetWaterCurrent(currentStats.WaterCurrent + this.WaterRestore);
            }

            foreach (var effect in this.Effects)
            {
                effect.Execute(new EffectActionContext(character));
            }
        }