/// <summary> /// Determines if the absorption shield is at least 900 and therefore close to maximum /// </summary> /// <returns>true is the absorption shield has a value of 900-999 (999 is max value but 1000+ would break this method if made possible)</returns> protected bool AbsorptionShieldIsHigh() { int left = 20; int right = 31; int top = 25; int bottom = 59; double hundredsPlaceWhite = Vision.FractionalMatchPiece(RGBHSBRangeFactory.White(), left, right, top, bottom); return(Numerical.WithinRange(hundredsPlaceWhite, 0.1476, 0.0005)); //TODO determine good values for range }
/// <summary> /// Eats a bite of rock cake if hitpoints are above 1 /// </summary> /// <returns>true if a bite of rock cake is taken</returns> protected bool Hitpoints() { if (TimeSinceLastOverload < overloadDrainTime || Numerical.CloseEnough(overloadBoostTime, TimeSinceLastOverload, 0.02)) { return(false); //an overload might be taking effect or wearing off } const double oneHitpoint = 0.035714285714285712; RectangleBounds hitpoints = Minimap.HitpointsDigitsArea(); double redHitpointsMatch = Vision.FractionalMatchPiece(HitpointsRed, hitpoints.Left, hitpoints.Right, hitpoints.Top, hitpoints.Bottom); if (Numerical.WithinRange(redHitpointsMatch, oneHitpoint, 0.01 * oneHitpoint) || (Minimap.Hitpoints() > 0.25)) { return(false); //hitpoints are already at 1 or an overload has just worn off and hitpoints are no longer red } Inventory.RightClickInventoryOption(0, 0, 1, false); //guzzle rock cake SafeWaitPlus(1000, 250); return(true); }