public void SetCostMap(CostMap cost_map, int cost_map_real_invul) { this.cost_map = cost_map; this.cost_map_real_invul = cost_map_real_invul; highlight_map = null; if (showC) { Redraw(); } }
float GetCost(int xpos, int ypos, byte life, sbyte invul, bool hasBonus) { CostMap cm = GetCostMap(life, invul, hasBonus); if (cm == null) { return(float.PositiveInfinity); } short xpix = Physics.pos_to_px(xpos); short ypix = Physics.pos_to_px(ypos); float cost = cm.CostAtPx(xpix, ypix, Flooding.GetRealInvul(life, invul)); float mult_cost = cost * Settings.cost_multiplier; return(cost > 0 && mult_cost <= 0 ? float.Epsilon : mult_cost); }
public ExtendedCostMap ComputeExtendedCostMap(WallClipSetting wcs, int invul_frames) { CostMap targetCM = ComputeCostMap(wcs, invul_frames); CostMap bonusCM = null; if (m.HasBonus != Map.BonusType.None && Settings.bonus_required) { bonusCM = ComputeCostMap(wcs, invul_frames, true); float max = 0; Rectangle r = m.GetBonusPxRect().Value; for (int y = r.Top; y < r.Bottom; y++) { for (int x = r.Left; x < r.Right; x++) { max = Math.Max(max, targetCM.CostAtPx((short)x, (short)y, 0)); } } bonusCM.GlobalMalus += max + Settings.back_before_bonus_malus; } return(new ExtendedCostMap(targetCM, bonusCM)); }
public ExtendedCostMap(CostMap targetCM, CostMap bonusCM) { this.targetCM = targetCM; this.bonusCM = bonusCM; }