public MRpawntoken(Pawn pawn) { this.counter = 0; this.ehc = 1f; this.amode = MainController.GetNextAttackMode(null); this.pawn = pawn; }
public static MRattackmode GetNextAttackMode(MRattackmode amode) { if (amode != null) { for (int i = 0; i < (Attackmodes.Count() - 1); i++) { if (Attackmodes[i].Equals(amode)) { return(Attackmodes[i + 1]); } } } return(Attackmodes.First()); }
private static void DeferedLoader() { //We prepare the attack mode array Attackmodes = new MRattackmode[Constants.Maxspecialeffects]; //Loading Textures & translations after init for (int i = 0; i < Constants.Maxspecialeffects; i++) { Attackmodes[i] = new MRattackmode(ContentFinder <Texture2D> .Get(Constants.Icontexpath + Constants.Icontexname[i]), Constants.Labelstring[i].Translate(), string.Format(Constants.Descstring[i].Translate(), Constants.Methresholds[i], Constants.Mechances[i]), Constants.Methresholds[i], Constants.Mechances[i], i); } LowChance = ContentFinder <Texture2D> .Get(Constants.Icontexpath + Constants.LowChanceTex); NoChance = ContentFinder <Texture2D> .Get(Constants.Icontexpath + Constants.NoChanceTex); LowChanceDesc = string.Format(Constants.LowChanceDesc.Translate()); NoChanceDesc = string.Format(Constants.NoChanceDesc.Translate()); }
public void ChooseAttackMode(Pawn target) { if (pawn.RaceProps.Humanlike) { // Rational pawns will try to use modes that have a reallistic chance to apply its effect // Pending generalization: 0 kill, 1 capture, 2 stun, 3 disarm // If we have a decent chance to capture, we go for it 1st if (MainController.Attackmodes[1].HasGoodChances(ehc)) { amode = MainController.Attackmodes[1]; return; } // Target driven decissions if (target != null) { // We try to stun if the target isn't if (MainController.Attackmodes[2].HasGoodChances(ehc)) { if (target.stances != null && !target.stances.stunner.Stunned) { amode = MainController.Attackmodes[2]; return; } } // We try to disarm if the target carries a weapon if (MainController.Attackmodes[3].HasGoodChances(ehc)) { if (target.equipment != null && target.equipment.Primary != null && target.equipment.Primary.def.IsWeapon) { amode = MainController.Attackmodes[3]; return; } } } } amode = MainController.Attackmodes[0]; return; }
public void UpdateMode(MRattackmode amode) { this.Token.amode = amode; }
public void NextAttackMode() { this.amode = MainController.GetNextAttackMode(amode); return; }