コード例 #1
0
        public List <Effect> GetAllEffects(EffectInheritance inherit, EffectLocation targetLocation)
        {
            var  list        = new List <Effect>();
            bool isSelf      = (inherit & EffectInheritance.Self) == EffectInheritance.Self;
            bool isInvisible = (inherit & EffectInheritance.Invisible) == EffectInheritance.Invisible;

            foreach (var effect in TechBase.Effects)
            {
                if (!CheckLocation(OwnerLocation, effect.Location, targetLocation))
                {
                    continue;
                }

                if (isSelf)
                {
                    if (!effect.IsPrivate)
                    {
                        list.Add(effect);
                    }
                }

                if (!isInvisible)
                {
                    continue;
                }

                if (effect.IsPrivate)
                {
                    list.Add(effect);
                }
            }
            return(list);
        }
コード例 #2
0
        public TechnologyManager(EffectLocation location, uint cityId, uint ownerId, IDbManager dbManager)
        {
            this.cityId    = cityId;
            this.dbManager = dbManager;

            OwnerLocation = location;
            OwnerId       = ownerId;
        }
コード例 #3
0
 public SpellEffectEventArgs(string effectName, string iD, string taleSpireId, EffectLocation effectLocation = EffectLocation.CreatureBase,
                             float lifeTime = 0, float secondsDelayStart = 0, float enlargeTime = 0, float shrinkTime = 0, float rotationDegrees = 0, float wallLength = 0, float distanceBetweenWallEffectsFeet = 0) : base(effectName, iD, taleSpireId)
 {
     RotationDegrees   = rotationDegrees;
     ShrinkTime        = shrinkTime;
     EnlargeTime       = enlargeTime;
     SecondsDelayStart = secondsDelayStart;
     EffectLocation    = effectLocation;
     LifeTime          = lifeTime;
     WallLength        = wallLength;
     DistanceBetweenWallEffectsFeet = distanceBetweenWallEffectsFeet;
 }
コード例 #4
0
        /*
         * Message for when attribute is full
         * message for player
         * message for target
         * message for room
         *
         */

        public bool AffectPlayerAttributes(string spellName, EffectLocation attribute, int value, Player player, Player target, Room room, string noAffect)
        {
            if ((attribute == EffectLocation.Hitpoints || attribute == EffectLocation.Mana || attribute == EffectLocation.Moves) && target.Attributes.Attribute[attribute] == target.MaxAttributes.Attribute[attribute])
            {
                _writer.WriteLine(ReplacePlaceholders(noAffect, target, false), player.ConnectionId);
                return(false);
            }

            target.Attributes.Attribute[attribute] += value;

            if ((attribute == EffectLocation.Hitpoints || attribute == EffectLocation.Mana || attribute == EffectLocation.Moves) && target.Attributes.Attribute[attribute] > target.MaxAttributes.Attribute[attribute])
            {
                target.Attributes.Attribute[attribute] = target.MaxAttributes.Attribute[attribute];
            }

            return(true);
        }
コード例 #5
0
 public ITechnologyManager CreateTechnologyManager(EffectLocation location, uint cityId, uint ownerId)
 {
     return(new TechnologyManager(location, cityId, ownerId, kernel.Get <IDbManager>()));
 }
コード例 #6
0
 public static bool CheckLocation(EffectLocation technologyLocation,
                                  EffectLocation effectPath,
                                  EffectLocation targetLocation)
 {
     return(effectPath == targetLocation);
 }
コード例 #7
0
        public override object Evaluate(List <string> args, ExpressionEvaluator evaluator, Creature player, Target target, CastedSpell spell, RollResults dice = null)
        {
            ExpectingArguments(args, 1, 9);
            if (player == null)
            {
                return(null);
            }

            string spellId;

            if (spell == null)
            {
                spellId = Guid.NewGuid().ToString();
            }
            else
            {
                spellId = spell.ID;
            }

            string         effectName        = Expressions.GetStr(args[0]);
            float          lifeTime          = 0;
            float          secondsDelayStart = 0;
            float          enlargeTime       = 0;
            float          shrinkTime        = 0;
            float          rotation          = 0;
            float          wallLength        = 0;
            float          distanceBetweenWallEffectsFeet = 2.5f;
            EffectLocation effectLocation = EffectLocation.CreatureBase;

            if (args.Count > 1)
            {
                lifeTime = (float)Expressions.GetDouble(args[1]);
                if (args.Count > 2)
                {
                    effectLocation = Expressions.Get <EffectLocation>(args[2]);
                    if (args.Count > 3)
                    {
                        secondsDelayStart = Expressions.GetFloat(args[3]);
                        if (args.Count > 4)
                        {
                            enlargeTime = Expressions.GetFloat(args[4]);
                            if (args.Count > 5)
                            {
                                shrinkTime = Expressions.GetFloat(args[5]);
                                if (args.Count > 6)
                                {
                                    rotation = Expressions.GetFloat(args[6]);
                                    if (args.Count > 7)
                                    {
                                        wallLength = Expressions.GetFloat(args[7]);
                                        if (args.Count > 8)
                                        {
                                            distanceBetweenWallEffectsFeet = Expressions.GetFloat(args[8]);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            OnPlayKnownEffect(effectName, spellId, player.taleSpireId, lifeTime, effectLocation, secondsDelayStart, enlargeTime, shrinkTime, rotation, wallLength, distanceBetweenWallEffectsFeet);

            return(null);
        }
コード例 #8
0
 static void OnPlayKnownEffect(string effectName, string spellId, string taleSpireId, float lifeTime, EffectLocation effectLocation, float secondsDelayStart, float enlargeTime, float shrinkTime, float rotation, float wallLength, float distanceBetweenWallEffectsFeet)
 {
     PlayEffect?.Invoke(null, new SpellEffectEventArgs(effectName, spellId, taleSpireId, effectLocation, lifeTime, secondsDelayStart, enlargeTime, shrinkTime, rotation, wallLength, distanceBetweenWallEffectsFeet));
 }