示例#1
0
 /**
  * Registers a character being killed by a given monster.
  * @param monster The type of monster that was killed
  * @param character The character that killed the monster
  */
 public void RegisterCharacterKilledByMonster(MDRMonster monster, MDRCharacter character)
 {
     if (!Enabled)
     {
         return;
     }
 }
示例#2
0
 public MonsterStatRecord(MDRMonster monster)
 {
     this.Monster = monster;
     this.ID      = monster.ID;
     this.Name    = monster.Name;
     this.IDLevel = IdentificationLevel.Auto;
 }
示例#3
0
        /** Registers that a given monster has been identified to given level */
        public void RegisterMonsterIdentified(MDRMonster monster, IdentificationLevel idLevel)
        {
            if (!Enabled)
            {
                return;
            }

            if (monster == null)
            {
                return;
            }

            if (idLevel == IdentificationLevel.Auto || idLevel == null)
            {
                return;
            }

            if (!MonsterStats.ContainsKey(monster))
            {
                MonsterStats[monster] = new MonsterStatRecord(monster);
            }
            MonsterStatRecord record = MonsterStats[monster];

            if (idLevel.ID > record.IDLevel.ID)
            {
                record.IDLevel = idLevel;
            }
        }
示例#4
0
    /** Calculates who attacks first, player or monsters.  Return true for player */
    public static bool CalculateInititive(MDRMonster monster, MDRCharacter character)
    {
        float initiative = 50 + ((monster.Stats.Dex - character.Stats.Dex) * 5f);

        initiative = Util.Clamp(initiative, 5f, 98f);
        return(Util.Roll(100) > initiative);
    }
示例#5
0
    /**
     * Calculates the XP a character should receive for dealing an amount of damage to a monster
     */
    public static int CalculateXP(MDRCharacter character, MDRMonster monster, int damage)
    {
        const float CompanionFactor  = 1.0f;
        float       GuildLevelFactor = 1 / (1 + (character.Membership.Current.CurrentLevel / 333));

        //float PartySizeFactor = (1 - ((Party.Count - 1) * 0.04f));
        float PartySizeFactor = 1f;

        int XPAwarded      = (int)(damage * (9 - Math.Log(damage + 1)) * (20 - Math.Log(damage)) * (monster.GuildLevel + 50) * CompanionFactor * GuildLevelFactor / 1000);
        int FinalXPAwarded = (int)(PartySizeFactor * XPAwarded);

        return(FinalXPAwarded);
    }
示例#6
0
        /**
         * Registers a monster being killed by given character.
         * @param character The character that killed the monster
         * @param monster The type of monster that was killed
         * @param count The number of this kind of monster the character just killed
         */
        public void RegisterMonsterKilled(MDRCharacter character, MDRMonster monster, int count = 1)
        {
            if (!Enabled)
            {
                return;
            }

            character.MonstersKilled += count;

            var mostDangeriousMonsterRecord = Records["Deadliest Creature Defeated"];

            if (mostDangeriousMonsterRecord != null)
            {
                CheckCharacterRecord("Deadliest Creature Defeated", monster.ToughnessRaiting, character, monster.Name, "{0} has set the record for defeating the most dangerious monster by killing a " + monster.Name + ".");
            }
        }
示例#7
0
        /**
         * Registers an item droped from a given monster.
         */
        public void RegisterItemFound(MDRCharacter character, MDRItemInstance itemInstance, MDRMonster monsterFoundOn)
        {
            if (!Enabled)
            {
                return;
            }

            if (itemInstance == null || itemInstance.Item == null)
            {
                return;
            }

            var item = itemInstance.Item;

            if (!ItemStats.ContainsKey(item))
            {
                ItemStats[item] = new ItemStatRecord(item);
            }
            ItemStatRecord record = ItemStats[item];

            if (record.NumberFound == 0)
            {
                record.FirstFoundBy = (character == null ? "unknown" : character.Name);
                if (character != null)
                {
                    PostNotification("Discovered " + itemInstance.Name, item.Icon);
                }
            }

            record.NumberFound++;
            if (monsterFoundOn != null)
            {
                record.LastFoundOnMonster = monsterFoundOn.Name;
            }
            record.LastSeenDate = DateTime.Now;

            RegisterItemIdentified(item, itemInstance.IDLevel);
        }
示例#8
0
文件: CoM.cs 项目: bsimser/CoM
 /** Formats monster name, including coloring.  Count is used for detecting plurals. */
 public static string Format(MDRMonster monster, int count = 1)
 {
     return(Util.Colorise(monster.Name + ((count > 1) ? "s" : ""), Colors.MONSTER_COLOR));
 }
示例#9
0
 /** Returns how difficult a monster is to identify */
 public static float MonsterIdentifyDifficulty(MDRMonster monster)
 {
     return(monster.AppearsOnLevel * 3f + (float)Math.Max(0f, (Math.Log10(monster.HitPoints) / 2f) - 1f));
 }
示例#10
0
 /** Returns the backstab hit chance reduction for a given monster */
 public static float MonsterBackstabReduction(MDRMonster monster)
 {
     return((float)Math.Log(1 + (monster.GuildLevel / 999)) * 50f);
 }