I don't really know if it's even possible, but it would be nice if it would. So, for my Role-Playing-Game, I tried to implement some other possible Quest-schemes (until know there were only the possibility of a monster-hunting-quest, now I wanted to implement some kinds of "Talk to this person"-Quests or "Find that and that Item"-Quest).
So I created a new Quest-Class, renamed the old Quest-Class to MonsterQuest and inherited it from Quest. So now, I have a List and want to go trough all elements until I find one element with KilledMonsters higher than 3, for example. THE PROBLEM is, that KilledMonster isn't implemented in the base-class, but only in the MonsterQuest-Class :(
Here are the classes how they are right now:
Quest
public class Quest
{
public int Accept_MinLevel { get; protected set; }
public string NPC_Name { get; protected set; }
public bool Accepted { get; protected set; }
public bool Completed { get; set; }
public bool HasStillRewards = true;
public double Reward_Experience { get; protected set; }
public int Reward_Money { get; protected set; }
public Quest(int accept_MinLevel, string npc_Name, double reward_experience, int reward_Money)
{
Accept_MinLevel = accept_MinLevel;
NPC_Name = npc_Name;
Reward_Money = reward_Money;
Reward_Experience = reward_experience;
}
public virtual void Update(GameTime gameTime)
{
}
public bool WaitForReward()
{
return Completed && HasStillRewards;
}
}
MonsterQuest
public class MonsterQuest : Quest
{
public List<Enemy> KilledEnemyList = new List<Enemy>();
public int RequiredMonster_Amount { get; private set; }
public string RequiredMonster_Name { get; private set; }
public int RequiredMonster_MinLevel { get; private set; }
public MonsterQuest(string npcName, int accept_MinLevel, string requiredMonster_Name, int requiredMonster_MinLevel, int requiredMonster_Amount, double reward_Experience, int reward_Money) : base(accept_MinLevel, npcName, reward_Experience, reward_Money)
{
NPC_Name = npcName;
Accept_MinLevel = accept_MinLevel;
RequiredMonster_Amount = requiredMonster_Amount;
RequiredMonster_MinLevel = requiredMonster_MinLevel;
RequiredMonster_Name = requiredMonster_Name;
Reward_Experience = reward_Experience;
Reward_Money = reward_Money;
}
public override void Update(GameTime gameTime)
{
if (KilledEnemyList.Capacity >= RequiredMonster_Amount)
Completed = true;
}
}
and, how I said, I want to do that (from another class. QuestList is just a List where I added a MonsterQuest element. This snippet is a part of my Enemy-Class, just to notice^^)
foreach (var item in Storyline.QuestList.Where(c => c.Accepted && !c.Completed && c.RequiredMonster_Name == Name && c.RequiredMonster_MinLevel <= Level))
{
item.KilledEnemyList.Add(this);
}
I hope anyone understand my problem and can help me solve it :)
Have a nice evening