public GlobalCritterStealingEventArgs(Critter cr, Critter thief, Item item, int count) { this.Cr = cr; this.Thief = thief; this.Item = Item; this.Count = Count; }
public static void InitAnimalEvil(Critter critter) { var builder = new CritterBehaviorBuilder (critter); builder .Do (new CallReinforcements (BlackboardKeys.Attackers)) .DoSequence ("3% to attack weakest animal from my team - fight over the area") .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10))) .Do (new AtChance<CritterBlackboard> (3)) .Do (new FindCritters (Find.Life).Choose (new Weakest ())).If (new SeesCritter ()).If (new IsTeamMember ()) .Do (new Attack ()) .End () .DoSequence ("10% to attack animal of same type from other team") .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10))) .Do (new AtChance<CritterBlackboard> (10)) .Do (new FindCritters (Find.Life).Choose (new BT.Random ())).If (new SeesCritter ()).IfNot (new IsTeamMember ()) .Do (new Attack ()) .End () .DoSequence ("Attack every non member and not same type critter") .Do (new FindCritters (Find.Life)).IfNot (new AmAttacking ()).If (new SeesCritter ()).If (new IsTeamMember ()).IfNot (new IsSameType ()) .Do (new Attack ()) .End () .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ()); Global.RegisterBehaviorTask (builder.MainTask); }
public UInt16Array ChooseAttackPosition(Critter npc, Critter target, AttackChoice attackChoice) { var weapon = npc.GetItemById (attackChoice.WeaponId); if (weapon == null) return null; var weaponDistance = weapon.Proto.WeaponMaxDist (attackChoice.WeaponUse); var distance = Global.GetDistance (npc, target); if (weaponDistance < distance) { var direction = Global.GetDirection (npc, target); var hexX = npc.HexX; var hexY = npc.HexY; do { npc.GetMap ().MoveHexByDir (ref hexX, ref hexY, direction, 1); } while(!npc.GetMap ().IsHexPassed (hexX, hexY)); var result = new UInt16Array (); result.Add (hexX); result.Add (hexY); result.Add ((ushort)direction); return result; } return null; }
// called by engine bool RaiseAttack(Critter cr, Critter target) { if (Attack != null) { var e = new ItemAttackEventArgs(this, cr, target); Attack(this, e); return e.Prevent; } return false; }
// called by engine public bool RaiseUse(Critter cr, Critter on_critter, Item on_item, IntPtr on_scenery) { if (Use != null) { var e = new ItemUseEventArgs(this, cr, on_critter, on_item, Scenery.FromNative(on_scenery)); Use(this, e); return e.Prevent; } return false; }
public static void InitGyro(Critter npc) { var builder = new CritterBehaviorBuilder(npc); builder .DoSequence("I am attacked") .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers)) //TODO: maybe run to guard .End(); Global.RegisterBehaviorTask(builder.MainTask); }
public static void InitAnimalGood(Critter critter) { var builder = new CritterBehaviorBuilder (critter); builder .Do (new CallReinforcements (BlackboardKeys.Attackers)) .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ()) .DoSequence ("Move randomly every 10-20 seconds") .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10), Time.RealSecond (20))) .Do (new MoveRandomly (1, 5)) .End (); Global.RegisterBehaviorTask (builder.MainTask); }
public static bool AddAttackPlane(this Critter npc, uint priority, Critter target, int minHp) { NpcPlane plane=Global.CreatePlane(); plane.Type=PlaneType.Attack; plane.Priority=(priority==0?Priorities.Attack:priority); plane.Attack_TargId=target.Id; plane.Attack_MinHp=minHp; plane.Attack_IsGag=false; plane.Attack_GagHexX=0; plane.Attack_GagHexY=0; plane.Attack_LastHexY=target.HexY; plane.Attack_LastHexX=target.HexX; plane.Run=false; return npc.AddPlane(plane); }
public Critter ChooseNextTarget(Critter npc, Critter currentTarget) { var enemyStack = new UIntArray (); npc.GetEnemyStack (enemyStack); for (int i = 0; i < enemyStack.Length; i++) { if (enemyStack [i] != 0) { var target = npc.GetMap ().GetCritter (enemyStack [i]); if (target != null) return target; } } return null; }
/** * Init methods for use in Mono */ public static void InitGuard(Critter npc) { var builder = new CritterBehaviorBuilder(npc); builder .DoSequence() .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers)) .Do(new BT.Say(FOnline.Say.NormOnHead, TextMsg.Text, 70140)) .Do(new Attack(BlackboardKeys.Attackers)) .End() .DoSelection() .Do(new ProvideReinforcements()) .End(); Global.RegisterBehaviorTask(builder.MainTask); }
/** * Init methods for use in Mono */ public static void InitGuard(Critter npc) { var builder = new CritterBehaviorBuilder(npc); builder .DoSequence() .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers)) .Do(new Attack(BlackboardKeys.Attackers)) .End() .DoSelection() .Do(new ProvideReinforcements()) .End() .DoSequence() .Do(new Patrol(Entire.Patrol)) .Do(new LookAround(3, Time.RealSecond(15))) .End(); Global.RegisterBehaviorTask(builder.MainTask); }
public static void InitCritter1(Critter npc) { var builder = new CritterBehaviorBuilder(npc); builder .Do(new TakeDrug(ItemPack.HealingDrugs).If(new IsHurt(70))) .DoSequence("Attack and call reinforcements") .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers)) .Do(new CallReinforcements(VirtualRealityReinforcements, BlackboardKeys.Attackers, BlackboardKeys.Killers)) .Do(new Attack(BlackboardKeys.Attackers)) .End() .Do(new ProvideReinforcements()).IfNot(new AmAttacking()) .Do(new ProvideReinforcements(VirtualRealityReinforcements)).IfNot(new AmAttacking()).If(new SeesCritter()) .DoSequence("Find player and attack him") .Do(new FindCritters(Find.Life | Find.OnlyPlayers).Choose(new Weakest())).If(new SeesCritter()).IfNot(new AmAttacking()) .Do(new Attack()) .End(); Global.RegisterBehaviorTask(builder.MainTask); }
/** * Init methods for use in Mono */ public static void InitHumanEvil(Critter critter) { var builder = new CritterBehaviorBuilder (critter); builder .Do (new CallReinforcements (BlackboardKeys.Attackers)) .Do (new TakeDrug (ItemPack.HealingDrugs)).If (new IsHurt (70)) .DoSequence ("20% to find weakest player and attack him instead") .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10))) .Do (new AtChance<CritterBlackboard> (20)) .Do (new FindCritters (Find.Life | Find.OnlyPlayers).Choose (new Weakest ())).If (new SeesCritter ()).IfNot (new IsTeamMember ()) .Do (new Attack ()) .End () .DoSequence ("Attack every non member") .Do (new FindCritters (Find.Life)).If (new SeesCritter ()).IfNot (new AmAttacking ()).IfNot (new IsTeamMember ()) .Do (new Attack ()) .End () .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ()); Global.RegisterBehaviorTask (builder.MainTask); }
public static bool AddAttackPlane(this Critter npc, uint priority, Critter target) { if(npc.IsPlayer) { Map map=npc.GetMap(); uint loc=0; if(map != null) loc=map.GetLocation().GetProtoId(); Global.Log("ERR: adding attack plane to player, loc pid={0}", loc); } NpcPlane plane=Global.CreatePlane(); plane.Type=PlaneType.Attack; plane.Priority=(priority==0?Priorities.Attack:priority); plane.Attack_TargId=target.Id; plane.Attack_MinHp=Global.DeadHitPoints; plane.Attack_IsGag=false; plane.Attack_GagHexX=0; plane.Attack_GagHexY=0; plane.Attack_LastHexX=target.HexX; plane.Attack_LastHexY=target.HexY; plane.Run=false; return npc.AddPlane(plane); }
public AttackChoice ChooseAttack(Critter npc, Critter target) { var attackChoice = new AttackChoice (); var currentItem = npc.GetItemHand (); Item weaponItem = null; if (currentItem != null) { if (CanBeMyWeapon (npc, currentItem)) { weaponItem = currentItem; } } else { weaponItem = null; } if (weaponItem == null) { return null; } attackChoice.WeaponId = weaponItem.Id; attackChoice.WeaponUse = 0; attackChoice.HitLocation = HitLocation.Uncalled; return attackChoice; }
private bool CanBeMyWeapon(Critter npc, Item item) { if (item.Type != ItemType.Weapon) return false; int skill = item.Proto.WeaponSkill (0); return skill == Skills.SmallGuns || skill == Skills.EnergyWeapons || skill == Skills.BigGuns; }
public CritterAttackedEventArgs(Critter cr, Critter attacker) : base(cr) { this.Attacker = attacker; }
public CritterFinishEventArgs(Critter cr, bool deleted) : base(cr) { this.Deleted = deleted; }
public bool RunDialog(Critter player, uint dialog_pack, ushort hx, ushort hy, bool ignore_distance) { return Global_RunDialogHex(player.ThisPtr, dialog_pack, hx, hy, ignore_distance); }
public bool RunDialog(Critter player, Critter npc, bool ignore_distance) { return Global_RunDialogNpc(player.ThisPtr, npc.ThisPtr, ignore_distance); }
public CritterSmthAttackEventArgs(Critter cr, Critter from_cr, Critter target) : base(cr, target) { this.From = from_cr; }
public CritterSmthStealingEventArgs(Critter cr, Critter from_cr, Critter thief, bool success, Item item, uint count) : base(cr, thief, success, item, count) { this.From = from_cr; }
public CritterSmthTurnBasedProcessEventArgs(Critter cr, Critter from_cr, Map map, bool begin_turn) : base(cr, map, begin_turn) { this.From = from_cr; }
public CritterTurnBasedProcessEventArgs(Critter cr, Map map, bool begin_turn) : base(cr) { this.Map = map; this.BeginTurn = begin_turn; }
public CritterGlobalProcessEventArgs(Critter cr, GlobalProcessType type, Item car) : base(cr) { this.Type = type; this.Car = car; }
public CritterVisEventArgs(Critter cr, Critter show_cr) : base(cr) { this.ShowCr = show_cr; }
public CritterSmthMoveItemEventArgs(Critter cr, Critter from_cr, Item item, ItemSlot from_slot) : base(cr, item, from_slot) { this.From = from_cr; }
public CritterSmthDropItemEventArgs(Critter cr, Critter from_cr, Item item) : base(cr, item) { this.From = from_cr; }
public void MoveItems(ItemArray items, Critter to_cr) { Global_MoveItemsCr(items.ThisPtr, to_cr.ThisPtr); }
public CritterSmthUseSkillEventArgs(Critter cr, Critter from_cr, int skill, Critter on_cr, Item on_item, Scenery on_scenery) : base(cr, skill, on_cr, on_item, on_scenery) { this.From = from_cr; }
public CritterChangeItemOnMapEventArgs(Critter cr, Item item) : base(cr) { this.Item = item; }
public CritterUseSkillOnMeEventArgs(Critter cr, Critter who_use, int skill) : base(cr) { this.WhoUse = who_use; this.Skill = skill; }
public CritterEventArgs(Critter cr) { this.Cr = cr; }
public CritterUseItemOnMeEventArgs(Critter cr, Critter who_use, Item item) : base(cr) { this.WhoUse = who_use; this.Item = item; }
public CritterSmthAttackedEventArgs(Critter cr, Critter from_cr, Critter attacker) : base(cr, attacker) { this.From = from_cr; }
public bool RunDialog(Critter player, Critter npc, uint dialog_pack, bool ignore_distance) { return Global_RunDialogNpcDlgPack(player.ThisPtr, npc.ThisPtr, dialog_pack, ignore_distance); }
public CritterSmthKnockoutEventArgs(Critter cr, Critter from_cr, uint anim2_begin, uint anim2_idle, uint anim2_end, uint lost_ap, uint knock_dist) : base(cr, anim2_begin, anim2_idle, anim2_end, lost_ap, knock_dist) { this.From = from_cr; }
public CritterAttackEventArgs(Critter cr, Critter target) : base(cr) { this.Target = target; }
public CritterDeadEventArgs(Critter cr, Critter killer) : base(cr) { this.Killer = killer; }
public ItemChoice ChooseItem(Critter npc, Critter target) { throw new NotImplementedException (); }
public MapInOutCritterEventArgs(Map map, Critter cr) : base(map) { this.Cr = cr; }
public SkillChoice ChooseSkill(Critter npc, Critter target) { throw new NotImplementedException (); }
// called by engine void RaiseCritterDead(Critter cr, Critter killer) { if (CritterDead != null) CritterDead (this, new MapCritterDeadEventArgs (this, cr, killer)); }
public void MoveItem(Item item, uint count, Critter to_cr) { Global_MoveItemCr(item.ThisPtr, count, to_cr.ThisPtr); }
// called by engine void RaiseTurnBasedProcess(Critter cr, bool begin_turn) { if (TurnBasedProcess != null) TurnBasedProcess (this, new MapTurnBasedProcessEventArgs (this, cr, begin_turn)); }
public MapCritterDeadEventArgs(Map map, Critter cr, Critter killer) : base(map) { this.Cr = cr; this.Killer = killer; }
public CritterSmthUseItemEventArgs(Critter cr, Critter from_cr, Item item, Critter on_cr, Item on_item, Scenery on_scenery) : base(cr, item, on_cr, on_item, on_scenery) { this.From = from_cr; }
public MapTurnBasedProcessEventArgs(Map map, Critter cr, bool begin_turn) : base(map) { this.Cr = cr; this.BeginTurn = begin_turn; }
public CritterMoveItemEventArgs(Critter cr, Item item, ItemSlot from_slot) : base(cr) { this.Item = item; this.FromSlot = from_slot; }
// called by engine void RaiseOutCritter(Critter cr) { if (OutCritter != null) OutCritter (this, new MapInOutCritterEventArgs (this, cr)); }
public CritterDropItemEventArgs(Critter cr, Item item) : base(cr) { this.Item = Item; }
public uint GetVisibleLocations(ushort wx, ushort wy, uint radius, Critter visible_for, LocationArray locations) { return Global_GetVisibleLocations(wx, wy, radius, visible_for.ThisPtr, (IntPtr)locations); }
public CritterSmthDeadEventArgs(Critter cr, Critter from_cr, Critter killer) : base(cr) { this.From = from_cr; this.Killer = killer; }