public override bool CanTarget(Creature creature) { if (!base.CanTarget(creature)) return false; // Named NPCs (normal dialog ones) can't be targeted. // Important because AIs target /pc/ and most NPCs are humans. if (creature.Has(CreatureStates.NamedNpc)) return false; return true; }
/// <summary> /// Stops meditation. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="dict"></param> /// <returns></returns> public override StartStopResult Stop(Creature creature, Skill skill, MabiDictionary dict) { creature.Regens.Remove("Meditation"); creature.Conditions.Deactivate(ConditionsE.Meditation); //Apply normal rest bonus instead of the campfire bonus if applicable. creature.Regens.Remove("Rest"); var restSkill = creature.Skills.Get(SkillId.Rest); if (restSkill != null && creature.Has(CreatureStates.SitDown)) { Life.Rest.ApplyRestBonus(creature, restSkill, creature.Temp.SittingProp != null ? creature.Temp.SittingProp.EntityId : 0); } return StartStopResult.Okay; }
/// <summary> /// Starts Meditation. /// </summary> /// <param name="creature"></param> /// <param name="skill"></param> /// <param name="dict"></param> /// <returns></returns> public override StartStopResult Start(Creature creature, Skill skill, MabiDictionary dict) { var rate = (skill.RankData.Var1 / 100f) * 0.05f; // TODO: Night? // "Disable" stm regen, triple hunger creature.Regens.Add("Meditation", Stat.Stamina, -0.4f, creature.StaminaMax); //Apply campfire rest bonus instead of the normal bonus if applicable. creature.Regens.Remove("Rest"); var restSkill = creature.Skills.Get(SkillId.Rest); if (restSkill != null && creature.Has(CreatureStates.SitDown)) { Life.Rest.RestCampfireBonus(creature, restSkill, creature.Temp.SittingProp != null ? creature.Temp.SittingProp.EntityId : 0); } if (ChannelServer.Instance.Conf.World.EnableHunger) creature.Regens.Add("Meditation", Stat.Hunger, 0.02f, creature.StaminaMax); // Add mana regen creature.Regens.Add("Meditation", Stat.Mana, rate, creature.ManaMax); creature.Conditions.Activate(ConditionsE.Meditation); return StartStopResult.Okay; }
public override bool CanTarget(Creature creature) { if (!base.CanTarget(creature)) return false; // Players can only target "bad" NPCs. if (creature.Has(CreatureStates.GoodNpc)) return false; // Players can't target players (outside of PvP, TODO) if (creature.IsPlayer) return false; return true; }
/// <summary> /// Returns true if creature is able to attack this creature. /// </summary> /// <param name="creature"></param> /// <returns></returns> public bool CanAttack(Creature creature) { if (creature.IsInvincible) return false; //Check override first... foreach (object target in this.AttackOverride) { //Check state first, then tag, then the creature itself. if (target is CreatureStates) { if (creature.Has((CreatureStates)target)) return true; } else if (target is string) { if (creature.HasTag((string)target)) return true; } else { if (creature == target) return true; } } //Then check the actual filter. foreach (object target in this.AttackFilter) { //Check state first, then tag, then the creature itself. if (target is CreatureStates) { if (creature.Has((CreatureStates)target)) return false; } else if (target is string) { if (creature.HasTag((string)target)) return false; } else { if (creature == target) return false; } } return true; }
public override bool Matches(Creature creature) { switch (this.Type) { case GlobalDropType.Npcs: var isMonster = creature.Has(CreatureStates.Npc); return isMonster; case GlobalDropType.Players: var isPlayer = (creature.IsPlayer); return isPlayer; } return false; }