/// <summary> /// Check whether all requirements are met by a specified actor /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool Completed(Actor actor) { return false; }
/// <summary> /// Determine whether a specific actor has completed the quest or at least one or more steps in the quest /// </summary> /// <param name="actor"></param> /// <returns></returns> public bool Completed(Actor actor) { int temp=_currentStep; if((_status==QuestProgress.Working)&& (temp<_steps.Count) &&(temp>-1)){ while( _steps[temp].Completed(actor) ||(temp==_currentStep) ||(_steps[temp].type!=QuestStepType.Normal)){ if(_steps[temp].Completed(actor)){ _steps[temp].status=QuestProgress.Finished; // Apply effects of quest state change } temp+=1; } }; return false; }
/// <summary> /// The constructor for the ActorTile /// Calls the constructor of Tile. /// </summary> /// <param name="parent">Just the parent object</param> /// <param name="actor">The to the tile connected actor.</param> public ActorTile(object parent, Actor actor) : this(parent) { _actor = actor; }
/// <summary> /// Move an actor on the map in a specified direction (does not check for walls - use CanMove) /// </summary> /// <param name="actor">The actor object to move</param> /// <param name="dir">Direction to move to</param> public void PositionActor(Actor actor, Coords coords) { if ((actor.tile != null) && (actor.tile.enabled)) { Backend.Coords source = actor.tile.coords; Backend.Coords target = coords; if (this[target].coords.x > -1) { // Remove ActorTile from current tile ((FloorTile)actor.tile.parent).Remove(actor.tile); // Add ActorTile to new Tile _tiles[target.y][target.x].Add(actor.tile); actor.tile.parent = _tiles[target.y][target.x]; // Remove old tile from updatelist (if no other actor or trap) if (!((_tiles[source.y][source.x].hasEnemy) || (_tiles[source.y][source.x].hasPlayer) || (_tiles[source.y][source.x].hasTrap))) _updateTiles.Remove(source); // Add new tile to updatelist _updateTiles.Add(target); } } }
/// <summary> /// Method to interact with a NPC. /// Either opens the NPC's shop or his dialogue. /// Calls the Eventhandler. /// </summary> /// <param name="With">The actor with which should be interacted</param> public void Interact(Actor With) { if (_hasShop) ((Backend.IHandleEvent)_tile.parent).HandleEvent(false, Backend.Events.Shop, this, With); if (_hasDialog) ((Backend.IHandleEvent)_tile.parent).HandleEvent(false, Backend.Events.Dialog, this, With, ""); }
/// <summary> /// Duplicates the properties of actor a to the current actor. /// </summary> /// <param name="a">The actor from which the properties should be cloned</param> public void copyFrom(Actor a) { _actorType = a.actorType; _armor = a.armor; _mana = a.mana; _damage = a.damage; _exp = a.exp; _expNeeded = a.expNeeded; _GUID = a.GUID; _gold = a.gold; _health = a.health; _inventory = a.inventory; if ((a is Player) && (this is Player)) { (this as Player).ClearQuests(); Quest[] myQuests = (a as Player).quests; foreach (Quest q in myQuests) { (this as Player).AddQuest(q); } } foreach (Item i in _inventory) { i.owner = this; } _level = a.level; _animationFile = a.animationFile; _manaReg = a.manaReg; _maxhealth = a.maxHealth; _maxMana = a.maxMana; _name = a.name; _evade = a.evade; _block = a.block; _penetrate = a.penetrate; _healthReg = a.healthReg; _skills = a.skills; _abilityPoints = a.abilityPoints; _armor = a.armor; _stealHealth = a.stealHealth; _stealMana = a.stealMana; _fireDamage = a.fireDamage; _iceDamage = a.iceDamage; _fireDefense = a.fireDefense; _iceDefense = a.iceDefense; _expNeeded = a.expNeeded; _exp = a.exp; _resist = a.resist; _viewRange = a.viewRange; _damage = a.damage; _level = a.level; _locked = a.locked; _manaReg = a.manaReg; _maxMana = a.maxMana; _destroyWeapon = a.destroyWeapon; _destroyArmor = a.destroyArmor; _scared = a.scared; _stunned = a.stunned; _charmed = a.charmed; _quicklist = a.quickList; _checkPointCoords = a.checkPointCoords; _lastCheckpoint = a.lastCheckpoint; _abilities = a.abilities; _lives = a.lives; _direction = a.direction; if ((a.actorType == ActorType.NPC) && (actorType == ActorType.NPC)) { NPC n = a as NPC; NPC t = this as NPC; if (a != null) { t.love = n.love; t.hasShop = n.hasShop; } } }
/// <summary> /// Method to drop an item from an actor to the ground. /// Deletes the item from the inventory and creats an itemtile to place the item on the ground /// </summary> /// <param name="tile">The tile on which the itemtile with the item will be added.</param> public void Drop(FloorTile tile) { if (_owner != null) _owner.inventory.Remove(this); _owner = null; _tile = new ItemTile(tile, this); tile.Add(_tile); }
/// <summary> /// Ein weiterer Konstruktor. /// </summary> /// <param name="owner">Der Besitzer-Actor des Items.</param> /// <param name="itemtype">Typ</param> /// <param name="name">Name</param> /// <param name="icon">Symbol</param> /// <param name="value">Wert</param> /// <param name="level">Level</param> public Item(Actor owner, ItemType itemtype, string name = "", ImageData icon = null, int value = 0, int level = 1) : this() { _owner = owner; _value = value; _level = level; _itemType = itemtype; if (name != "") { _name = name; } else { GenerateName(); } _icon = icon; if (icon == null) GenerateIcon(); }
/// <summary> /// Method called when an actor picks up an item from the ground. /// Replaces the old owner and deletes the itemtile from the map /// </summary> /// <param name="actor">The actor which gains the item</param> public void Pickup(Actor actor) { if (_owner != null) { _owner.inventory.Remove(this); } _owner = actor; int temp = 0; if (_itemType != Backend.ItemType.Gold) { for (int i = 0; i < actor.inventory.Count; ++i) { temp = Math.Max(id, actor.inventory[i].id); } _id = temp + 1; actor.AddItem(this); } else { actor.gold += _value; } _tile = null; }