Ejemplo n.º 1
0
        /// <summary>
        /// Song of weakness.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongWeakling(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_STRENGTH_REDUCED) ||
                    Magic.SpellSavingThrow(level, victim, AttackType.DamageType.black_magic))
                {
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 7;
                af.AddModifier(Affect.Apply.strength, -(level / 2));
                af.SetBitvector(Affect.AFFECT_STRENGTH_REDUCED);

                if (level > 25)
                {
                    af.AddModifier(Affect.Apply.damroll, 0 - (level / 7));
                }

                victim.AddAffect(af);

                SocketConnection.Act("$n&n looks weaker.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel weaker.\r\n");
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Song of idiocy.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongIdiocy(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FEEBLEMIND) ||
                    Magic.SpellSavingThrow(level, victim, AttackType.DamageType.black_magic))
                {
                    ch.SendText("You failed!\r\n");
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 9;
                af.AddModifier(Affect.Apply.intelligence, 0 - (level + 15));
                af.SetBitvector(Affect.AFFECT_FEEBLEMIND);
                victim.AddAffect(af);

                SocketConnection.Act("A dumb look crosses $n&n's face and $e starts to drool.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel _REALLY_ dumb.\r\n");
            }
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Song of nightmares.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongNightmares(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FEAR) || Magic.SpellSavingThrow(level, victim,
                                                                                    AttackType.DamageType.black_magic))
                {
                    ch.SendText("You have failed.\r\n");
                    ch.SendText("You resist the urge to panic.\r\n");
                    continue;
                }

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = 1 + (level / 7);
                af.SetBitvector(Affect.AFFECT_FEAR);
                victim.AddAffect(af);

                SocketConnection.Act("$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.character);
                victim.SendText("You are scared!\r\n");
                SocketConnection.Act("$N&n is scared!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);

                CommandType.Interpret(victim, "flee");
                if (victim.IsNPC())
                {
                    Combat.StartFearing(victim, ch);
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        public Dictionary <CharacterKey, Dictionary <String, Affect> > ProcessSpecialAbilities()
        {
            foreach (Character actor in characters.Values)
            {
                if (actor.SpecialAbility != null &&
                    actor.SpecialAbility.Type == SpecialAbilityType.Passive)
                {
                    bool friendly = actor.SpecialAbility.Friendly;

                    foreach (KeyValuePair <CharacterKey, Character> kv in characters)
                    {
                        if ((actor.Owner.Name != kv.Key.Owner || actor.RootName != kv.Value.RootName) &&
                            ((friendly && actor.Owner.Name == kv.Key.Owner) ||
                             (!friendly && actor.Owner.Name != kv.Key.Owner)) &&
                            !actor.Health.IsDead && !kv.Value.Health.IsDead)
                        {
                            Affect affect = actor.SpecialAbility.Process(actor, kv.Value);
                            if (affect != null)
                            {
                                if (affects[kv.Key].ContainsKey(affect.RootName))
                                {
                                    affects[kv.Key][affect.RootName] = affect;
                                }
                                else
                                {
                                    affects[kv.Key].Add(affect.RootName, affect);
                                }
                            }
                        }
                    }
                }
            }

            return(affects);
        }
        /// <inheritdoc />
        public async ValueTask ExecuteAsync
            (String sql,
            CancellationToken cancellationToken = default,
            Object?args        = null,
            Int32?queryTimeout = null,
            Affect affect      = Affect.Any)
        {
            var cmd = CreateCommand(sql, cancellationToken, args, queryTimeout);

            try {
                var affectedRowsCount = await npgsqlConnection.ExecuteAsync(cmd);

                var assertionFailure =
                    affect switch {
                    Affect.SingleRow when affectedRowsCount != 1 =>
                    $"Expected query to affect single row, but affected {affectedRowsCount} rows.",
                    Affect.AtLeastOneRow when affectedRowsCount < 1 =>
                    $"Expected query to affect at least one row, but affected {affectedRowsCount} rows.",
                    _ =>
                    null
                };
                if (assertionFailure is {})
                {
                    var msg =
                        assertionFailure
                        + $"{Environment.NewLine}Connection string: {npgsqlConnection.ConnectionString}"
                        + $"{Environment.NewLine}Query:{Environment.NewLine}"
                        + sql;
                    throw new SqlException.AssertionFailure(msg);
                }
            }
Ejemplo n.º 6
0
        /// <summary>
        /// Song of sleep.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongSleep(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_SLEEP) ||
                    Magic.SpellSavingThrow(level, victim, AttackType.DamageType.charm) ||
                    victim.GetRace() == Race.RACE_VAMPIRE ||
                    ch.IsSameGroup(victim))
                {
                    continue;
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, level / 8, Affect.Apply.none, 0, Affect.AFFECT_SLEEP);
                victim.CombineAffect(af);

                if (victim.IsAwake())
                {
                    victim.SendText("You feel very sleepy... zzzzz.\r\n");
                    if (ch.Fighting || victim.CurrentPosition == Position.fighting)
                    {
                        Combat.StopFighting(victim, false);
                    }
                    CommandType.Interpret(victim, "sleep");
                }
            }

            return(true);
        }
Ejemplo n.º 7
0
Archivo: Weaken.cs Proyecto: semtle/MIM
        private static async Task DoWeaken(Player attacker, Room room)
        {
            _taskRunnning   = true;
            attacker.Status = Player.PlayerStatus.Busy;


            await Task.Delay(500);


            var castingTextAttacker =
                Helpers.ReturnName(_target, attacker, null) + "'s muscles shrink making them look weaker.";

            var castingTextDefender = "You feel weaker as your muscles shrink.";

            HubContext.SendToClient(castingTextAttacker, attacker.HubGuid);
            HubContext.SendToClient(castingTextDefender, _target.HubGuid);

            foreach (var character in room.players)
            {
                if (character == attacker)
                {
                    continue;
                }

                if (character != _target)
                {
                    var roomMessage = $"{Helpers.ReturnName(_target, character, string.Empty)}'s  muscles shrink making them look weaker.";

                    HubContext.SendToClient(roomMessage, character.HubGuid);
                }
            }

            _target.Strength -= 2;


            var weakenAff = new Affect
            {
                Name     = "Weaken",
                Duration = attacker.Level + 5,
                AffectLossMessagePlayer = "Your muscles regain there mass and strength.",
                AffectLossMessageRoom   = $" muscles regain there mass and strength."
            };


            if (_target.Affects == null)
            {
                _target.Affects = new List <Affect>();
                _target.Affects.Add(weakenAff);
            }
            else
            {
                _target.Affects.Add(weakenAff);
            }

            Score.ReturnScoreUI(_target);

            Player.SetState(attacker);
            _target       = null;
            _taskRunnning = false;
        }
Ejemplo n.º 8
0
        public void AddAffectWidget(Combatant combatant, Affect affect)
        {
            combatant.Affects.Add(affect);

            var sorted = combatant.Affects.OrderBy(a => a.Description).ToList();

            combatant.Affects = sorted;

            Notify();
        }
Ejemplo n.º 9
0
        internal static Player load_mob(int monster_id, bool exit)
        {
            string area_text = gbl.game_area.ToString();

            byte[] data;
            short  decode_size;

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "CHA.dax");

            if (decode_size == 0)
            {
                if (exit)
                {
                    seg041.DisplayAndPause("Unable to load monster", 15);
                    seg043.print_and_exit();
                }
                else
                {
                    return(null);
                }
            }

            Player player = new Player(data, 0);

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "SPC.dax");

            if (decode_size != 0)
            {
                int offset = 0;

                do
                {
                    Affect affect = new Affect(data, offset);
                    player.affects.Add(affect);

                    offset += 9;
                } while (offset < decode_size);
            }

            seg042.load_decode_dax(out data, out decode_size, monster_id, "MON" + area_text + "ITM.dax");

            if (decode_size != 0)
            {
                for (int offset = 0; offset < decode_size; offset += Item.StructSize)
                {
                    player.items.Add(new Item(data, offset));
                }
            }

            seg043.clear_keyboard();

            return(player);
        }
Ejemplo n.º 10
0
        public void AddAffect(Affect affect)
        {
            _bank.Affects.Add(affect);

            var sort = _bank.Affects.OrderBy(a => a.Description).ToList();

            _bank.Affects = sort;

            UpdateConcentration(affect, true);

            Notify();
        }
Ejemplo n.º 11
0
 public Status(String _name, int _duration, int _power, Effect_Time _effect_time, Type _type, Texture2D _img, Affect _Effect, Affect _Reverse = null)
 {
     name                = _name;
     power               = _power;
     duration            = _duration;
     duration_left       = duration;
     img                 = _img;
     effect_time         = _effect_time;
     type                = _type;
     this.affect         = _Effect;
     this.reverse_affect = _Reverse;
 }
Ejemplo n.º 12
0
        public async Task <Affect> Post([FromBody] Affect affect)
        {
            await Database.InsertAsync(affect);

            const string sql = @"SELECT * FROM affects
                JOIN activities USING(activity_id)
                JOIN influences USING(influence_name)
                JOIN factors USING(factor_id)
                WHERE affect_id = @0";

            return(Database.Fetch <Affect, Activity, Influence, Factor>(sql, affect.AffectId).FirstOrDefault());
        }
Ejemplo n.º 13
0
        private List <Affect> Expire(List <Affect> list, Affect affect)
        {
            foreach (var combatant in _bank.Combatants)
            {
                combatant.Affects.Remove(affect);
            }

            list.Remove(affect);

            UpdateConcentration(affect, false);

            return(list);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Song of heroism.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongHeroism(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 8), Affect.Apply.hitroll, (level / 6 + 1), Affect.AFFECT_NONE);
                victim.AddAffect(af);
                af = new Affect(Affect.AffectType.song, spell.Name, (level / 8), Affect.Apply.damroll, (level / 11 + 1), Affect.AFFECT_NONE);
                victim.AddAffect(af);

                SocketConnection.Act("$n&n looks more courageous.", victim, null, null, SocketConnection.MessageTarget.room);
                victim.SendText("You feel righteous.\r\n");
            }
            return(true);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Song of cowardice.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongCowardice(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                if (!victim.IsSameGroup(ch))
                {
                    Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6 + 1), Affect.Apply.hitroll, (0 - (level / 3)), Affect.AFFECT_COWARDLY);
                    victim.AddAffect(af);

                    SocketConnection.Act("$n&n looks unsure of $mself.", victim, null, null, SocketConnection.MessageTarget.room);
                    victim.SendText("You feel less confident about your battle skills.\r\n");
                }
            }
            return(true);
        }
Ejemplo n.º 16
0
        private void UpdateConcentration(Affect affect, bool adding)
        {
            if (affect.IsConcentration)
            //if (affect.IsConcentration == resources.Affects.Concentration.YES)
            {
                var combatant = _bank.Combatants.FirstOrDefault(c => c.Name == affect.Expiration.Turn);

                combatant.IsConcentrating     = adding;
                combatant.ConcentrationAffect = adding ? affect : null;
            }

            if (OnCombatantChanged != null)
            {
                OnCombatantChanged(this, new CombatantChangedEventArgs());
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Song of flight.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongFlight(CharData ch, Spell spell, int level, Target target)
        {
            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_FLYING))
                {
                    return(true);
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6), Affect.Apply.none, 0, Affect.AFFECT_FLYING);
                victim.AddAffect(af);

                victim.SendText("&+WYour feet rise off the ground.&n\r\n");
                SocketConnection.Act("$n&n rises off the ground.", victim, null, null, SocketConnection.MessageTarget.room);
            }
            return(true);
        }
Ejemplo n.º 18
0
        public int WarCry(Player player, Player target, Room room)
        {
            if (player.Affects.Custom.FirstOrDefault(x => x.Name.Equals("War Cry")) != null)
            {
                _writer.WriteLine("You are already affected by War Cry.", player.ConnectionId);
                return(0);
            }


            var skillMessage = new SkillMessage()
            {
                Hit =
                {
                    ToPlayer = $"You scream a loud war cry.",
                    ToRoom   = $"{player.Name} screams a loud war cry.",
                    ToTarget = $""
                }
            };


            _skillManager.EmoteAction(player, target, room, skillMessage);

            var affect = new Affect()
            {
                Duration = player.Level + player.Level / 5,
                Modifier = new Modifier()
                {
                    DamRoll = 3,
                    Armour  = -2
                },
                Affects = DefineSpell.SpellAffect.Berserk,
                Name    = "War Cry"
            };

            player.Affects.Custom.Add(affect);

            Helpers.ApplyAffects(affect, player);
            _updateClientUi.UpdateScore(player);
            _updateClientUi.UpdateMoves(player);
            _updateClientUi.UpdateHP(player);
            _updateClientUi.UpdateAffects(player);
            _updateClientUi.UpdateExp(player);


            return(0);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Song of invisibility.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongInvisibility(CharData ch, Spell spell, int level, Target target)
        {
            int total = 0;

            int max = level / 8;

            foreach (CharData victim in ch.InRoom.People)
            {
                if (!victim.IsSameGroup(ch) || victim.IsAffected(Affect.AFFECT_INVISIBLE))
                {
                    continue;
                }

                if (total >= max)
                {
                    return(true);
                }

                victim.SendText("You slowly fade out of existence.\r\n");
                SocketConnection.Act("$n&n slowly fades out of existence.", victim, null, null, SocketConnection.MessageTarget.room);

                Affect af = new Affect(Affect.AffectType.song, spell.Name, (level / 6), Affect.Apply.none, 0, Affect.AFFECT_INVISIBLE);
                victim.AddAffect(af);
                total++;
            }
            foreach (Object obj in ch.InRoom.Contents)
            {
                if (obj.HasFlag(ObjTemplate.ITEM_INVIS))
                {
                    continue;
                }

                if (total >= max)
                {
                    return(true);
                }

                SocketConnection.Act("&+L$p&+L fades away.", ch, obj, null, SocketConnection.MessageTarget.room);
                SocketConnection.Act("&+L$p&+L fades away.", ch, obj, null, SocketConnection.MessageTarget.character);
                obj.AddFlag(ObjTemplate.ITEM_INVIS);
                total++;
            }
            return(true);
        }
Ejemplo n.º 20
0
        /// <inheritdoc />
        public async ValueTask ExecuteAsync
            (String sql,
            CancellationToken cancellationToken = default,
            Object?args        = null,
            Int32?queryTimeout = null,
            Affect affect      = Affect.Any)
        {
            var transaction = await BeginTransaction(cancellationToken).ConfigureAwait(false);

            try {
                await transaction.ExecuteAsync(sql, cancellationToken, args, queryTimeout, affect)
                .ConfigureAwait(false);

                await transaction.CommitAsync(cancellationToken).ConfigureAwait(false);
            }
            finally {
                await transaction.DisposeAsync().ConfigureAwait(false);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Song of armor.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongArmor(CharData ch, Spell spell, int level, Target target)
        {
            ch.SendText("You Sing a song of protection.\r\n");

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_ARMOR))
                {
                    continue;
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, 4, Affect.Apply.ac, (0 - (10 + (level / 5))), Affect.AFFECT_ARMOR);
                victim.CombineAffect(af);

                victim.SendText("You feel someone protecting you.\r\n");
            }

            return(true);
        }
Ejemplo n.º 22
0
        public async Task <Affect> Post([FromBody] Affect affect)
        {
            await DbContext.Affects.InsertOneAsync(affect);

            return(await DbContext
                   .Affects
                   .Aggregate()
                   .Match(a => a.AffectId == affect.AffectId)
                   .Lookup <Aspect, AffectTempResult>("Aspects", "AspectId", "AspectId", "Aspect")
                   .Lookup <AspectType, AffectTempResult>("AspectTypes", "Aspect.AspectTypeId", "AspectTypeId", "AspectType")
                   .Lookup <Factor, AffectTempResult>("Factors", "FactorId", "FactorId", "Factor")
                   .Lookup <Influence, AffectTempResult>("Influences", "InfluenceId", "InfluenceId", "Influence")
                   .Unwind("Aspect")
                   .Unwind("AspectType")
                   .Unwind("Factor")
                   .Unwind("Influence")
                   .As <AffectResult>()
                   .FirstAsync());
        }
Ejemplo n.º 23
0
        static private string affectToEnglish(Affect affect)
        {
            Encoding encoding = Encoding.GetEncoding(932);

            switch (affect)
            {
            case Affect.yorokobi:
                return("happiness");

            case Affect.suki:
                return("fondness");

            case Affect.yasu:
                return("relief");

            case Affect.ikari:
                return("anger");

            case Affect.aware:
                return("sadness");

            case Affect.kowa:
                return("fear");

            case Affect.haji:
                return("shame");

            case Affect.iya:
                return("disgust");

            case Affect.takaburi:
                return("excitement");

            case Affect.odoroki:
                return("surprise");

            case Affect.mu:
                return("neutral");

            default:
                return("error");
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Song of warding, protective.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongWarding(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 7;
                af.AddModifier(Affect.Apply.save_spell, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_paralysis, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_petrification, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_poison, 0 - ((level / 5) + 1));
                af.AddModifier(Affect.Apply.save_breath, 0 - ((level / 5) + 1));
                af.SetBitvector(Affect.AFFECT_NONE);
                victim.AddAffect(af);
            }
            return(true);
        }
Ejemplo n.º 25
0
        static private string affectToEnglishAbbreviation(Affect affect)
        {
            Encoding encoding = Encoding.GetEncoding(932);

            switch (affect)
            {
            case Affect.yorokobi:
                return("H");

            case Affect.suki:
                return("Fo");

            case Affect.yasu:
                return("R");

            case Affect.ikari:
                return("A");

            case Affect.aware:
                return("Sa");

            case Affect.kowa:
                return("Fe");

            case Affect.haji:
                return("Sh");

            case Affect.iya:
                return("D");

            case Affect.takaburi:
                return("E");

            case Affect.odoroki:
                return("Su");

            case Affect.mu:
                return("N");

            default:
                return("error");
            }
        }
Ejemplo n.º 26
0
        static private string affectToJapanese(Affect affect)
        {
            Encoding encoding = Encoding.GetEncoding(932);

            switch (affect)
            {
            case Affect.yorokobi:
                return("喜");

            case Affect.suki:
                return("好");

            case Affect.yasu:
                return("安");

            case Affect.ikari:
                return("怒");

            case Affect.aware:
                return("哀");

            case Affect.kowa:
                return("怖");

            case Affect.haji:
                return("恥");

            case Affect.iya:
                return("厭");

            case Affect.takaburi:
                return("昂");

            case Affect.odoroki:
                return("驚");

            case Affect.mu:
                return("無");

            default:
                return("error");
            }
        }
Ejemplo n.º 27
0
        public void AssignAffect(Affect affect)
        {
            if (_bank.AffectBeingAssigned == affect)
            {
                _bank.AffectBeingAssigned = null;
            }
            else
            {
                _bank.AffectBeingAssigned = affect;
            }

            if (OnAssignmentAffectChanged != null)
            {
                OnAssignmentAffectChanged(this, new AssignmentAffectChangedEventArgs {
                    Affect = _bank.AffectBeingAssigned
                });
            }

            Notify();
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Song of obscrurement.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongObscurement(CharData ch, Spell spell, int level, Target target)
        {
            Affect af = new Affect();

            foreach (CharData victim in ch.InRoom.People)
            {
                if (victim.IsAffected(Affect.AFFECT_MINOR_INVIS) || victim.IsAffected(Affect.AFFECT_INVISIBLE))
                {
                    return(true);
                }

                SocketConnection.Act("$n&n fades out of existence.", ch, null, null, SocketConnection.MessageTarget.room);
                ch.SendText("You vanish.\r\n");

                af.Type     = Affect.AffectType.song;
                af.Value    = spell.Name;
                af.Duration = level / 6;
                af.SetBitvector(Affect.AFFECT_MINOR_INVIS);
                victim.AddAffect(af);
            }
            return(true);
        }
Ejemplo n.º 29
0
        private void ProcessSpecialAbilityAttack(Character actor, Character target)
        {
            if (actor.SpecialAbility != null &&
                actor.SpecialAbility.Type == SpecialAbilityType.Attack)
            {
                Affect affect = actor.SpecialAbility.Process(actor, target);
                if (affect != null)
                {
                    Dictionary <String, Affect> characterAffects =
                        affects.First(q => q.Key.Owner == target.Owner.Name &&
                                      q.Key.Character == target.RootName).Value;

                    if (characterAffects.ContainsKey(affect.RootName))
                    {
                        characterAffects[affect.RootName] = affect;
                    }
                    else
                    {
                        characterAffects.Add(affect.RootName, affect);
                    }
                }
            }
        }
Ejemplo n.º 30
0
        public WidgetCss GetClass(Affect affect, bool isChild)
        {
            if (affect.AssignmentMode && !isChild)
            {
                return(new WidgetCss {
                    Main = "widget affect assign",
                    Close = "close"
                });
            }

            if (isChild)
            {
                return(new WidgetCss {
                    Main = "widget affect applied",
                    Close = "close"
                });
            }

            return(new WidgetCss {
                Main = "widget affect",
                Close = "close"
            });
        }
Ejemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        friendship = new Need ("friendship", friendship.currentVal, friendship.changeRate);
        enmity = new Need ("enmity", enmity.currentVal, enmity.changeRate);
        competition = new Need ("competition", competition.currentVal, competition.changeRate);
        lust = new Need ("lust", lust.currentVal, lust.changeRate);
        greed = new Need ("greed", greed.currentVal, greed.changeRate);
        mentorship = new Need ("mentorship", mentorship.currentVal, mentorship.changeRate);

        #region Initializing Needs Dicitonary

        needs.Add ("friendship", friendship);
        needs.Add ("enmity", enmity);
        needs.Add ("competition", competition);
        needs.Add ("lust", lust);
        needs.Add ("greed", greed);
        needs.Add ("mentorship", mentorship);

        #endregion

        boredomToInterest = new Affect ("boredomToInterest", boredomToInterest.currentVal);
        sadToJoy = new Affect ("sadToJoy", sadToJoy.currentVal);
        supriseToCalm = new Affect ("supriseToCalm", supriseToCalm.currentVal);
        distressToAmused = new Affect ("distressToAmused", distressToAmused.currentVal);
        angerToCheers = new Affect ("angerToCheers", angerToCheers.currentVal);
        disgustToLove = new Affect ("disgustToLove", disgustToLove.currentVal);
        shameToPride = new Affect ("shameToPride", shameToPride.currentVal);
        fearToHope = new Affect ("fearToHope", fearToHope.currentVal);

        #region Initializing Affects Dictionary

        affects.Add ("boredomToInterest", boredomToInterest);
        affects.Add ("sadToJoy", sadToJoy);
        affects.Add ("supriseToCalm", supriseToCalm);
        affects.Add ("distressToAmused", distressToAmused);
        affects.Add ("angerToCheers", angerToCheers);
        affects.Add ("disgustToLove", disgustToLove);
        affects.Add ("shameToPride", shameToPride);
        affects.Add ("fearToHope", fearToHope);

        #endregion;
    }
Ejemplo n.º 32
0
    public void returnHighestAffect()
    {
        foreach (KeyValuePair<string, Affect> a in affects) {
            if (a.Value.CompareTo (highestAffect) == 1) {

                highestAffect = a.Value;
            }
        }

        currentAffect = highestAffect.returnName ();
    }