Can an artificer heal a homunculus servant at range?

In the official version of artificer, the ability to create a homunculus servant is gained at 6th level. Among its other abilities, the homunculus can:

Channel Magic The homunculus delivers a spell you cast that has a range of touch. The homunculus must be within 120 feet of you.


The homunculus regains 2d6 hit points if the mending spell is cast on it

Mending has a range of touch. Is there any reason an artificer cannot use the spell to repair his homunculus servant so long as it is within 120 feet?

How Should Speed and Range Affect Hit Probability?

If one were to go for an increased degree of realism, and try to build a probability curve that produces most sensible results (but simplified, of course, since there is no such thing as a perfect simulation), then approximately what sort of correlation should there be between distance to the target, speed of the target, and the chance to hit the target (under otherwise similar circumstances, i.e. same aiming time, weapon, character/skill etc.)?

Examples: There are systems which reduce the chance to hit by the same percent per range fixed increment added to the range of the target. There are systems which stack range penalties by a logarithmic function of range (e.g. a stacking penalty per doubling until reaching some cutoff range). There are systems which provide a constant speed penalty entirely separately from range, and systems which add speed and range when calculating the penalty. Some of these systems’ probability effects are complicated by the fact that they use non-linear dice curves. Some argue that the function of probability reduction should be a quadratic relation to range, since for each doubling of range, the target’s projection becomes ¼ of its previous observed value (percent of FoV taken up), but I don’t recall any systems that explicitly and deliberately implemented anything like that.

After asking elsewhere, I’ve been pointed to Steering law and Fitt’s law, but seem to be meant for fixed accuracy and variable time, while in RPGs, fixed aim time and variable chance to hit are much more workable.

Note that I’m not asking about which dice mechanics to use for modelling those probability adjustments, as I’m assuming that there are multiple ways of fitting dice to a desired probability function, but first I’d like to learn what probability functions are most fitting (simplified and generalised, of course) representation of real life shooting situations.

Most efficient way to query a date range in Postgresql

I have a table with a timestamp with tz column. I want to perform a count / group by query for rows within a certain date range:

select count(1), url  from mytable  where viewed_at between '2019-01-01' and '2020-01-01'; 

viewed_at has a btree index applied, but when I view explain... it doesn’t appear to be using the index:

postgres=# explain select count(1), url from app_pageview where viewed_at < '2019-01-01' group by 2 order by 1 desc limit 10;                                                       QUERY PLAN                                                        -----------------------------------------------------------------------------------------------------------------------  Limit  (cost=2165636.99..2165637.02 rows=10 width=32)    ->  Sort  (cost=2165636.99..2165637.24 rows=101 width=32)          Sort Key: (count(1)) DESC          ->  Finalize GroupAggregate  (cost=2165609.22..2165634.81 rows=101 width=32)                Group Key: url                ->  Gather Merge  (cost=2165609.22..2165632.79 rows=202 width=32)                      Workers Planned: 2                      ->  Sort  (cost=2164609.20..2164609.45 rows=101 width=32)                            Sort Key: url                            ->  Partial HashAggregate  (cost=2164604.82..2164605.83 rows=101 width=32)                                  Group Key: url                                  ->  Parallel Seq Scan on app_pageview  (cost=0.00..2059295.33 rows=21061898 width=24)                                        Filter: (viewed_at < '2019-01-01 00:00:00+00'::timestamp with time zone)  JIT:    Functions: 13    Options: Inlining true, Optimization true, Expressions true, Deforming true (16 rows) 

I have generated ~100M rows of dummy data to test this out.

How can I make it more efficient?

Would storing the viewed_at field as two different fields be any use (date and time)

Is there a data structure that can perform range modulo additions and range minimum queries?

It is well-known that the Segment Tree performs range additions and range minimum queries in O(logN) each.

Let each element in the array have value V[i], M[i]. We define a “range modulo add” as the following: add +X to V[i] for each element in the range L<=i<=R and then calculate modulo M[i] for each element L<=i<=R. Can both this operation and range minimum queries be run in (worst-case or average-case) o(N)? If not on ranges [L,R], is it possible to handle range minimum queries and range modulo adds on the entire array quickly?

Can a multitarget spell with range of Touch be delivered by familiar AND caster simultaneously?

I’m a level 5 warlock with Pact of the Chain, so I can cast Invisibility with a level 3 slot, and cause 2 creatures to become invisible.

Can I use my familiar to deliver invisibility to someone who isn’t in my range (like 80feet away from me) and myself with 1 cast?

What happens when the UA Bait and Switch maneuver is used on a grappled ally when both the user and ally are still within the grappler’s range?

This question is based on this one: What happens when the UA Bait and Switch maneuver is used on a grappled ally when the maneuver-user is out of the grappling monster's reach?

The Unearthed Arcana Class Feature Variants includes the Bait and Switch fighter maneuver (page 5), which states:

When you’re within 5 feet of an ally on your turn, you can expend one superiority die and switch places with that ally, provided you spend at least 5 feet of movement. This movement doesn’t provoke opportunity attacks […]

What happens when the Bait and Switch maneuver is used on a grappled ally when both the maneuver-user and the ally are still within grapple range of the grappling creature?

I see two possible outcomes:

  1. The maneuver-user takes the ally’s place in being grappled, and can then attempt to break out of that grapple.

  2. The ally is still grappled, but has now been possibly moved to a more beneficial position.

I am not sure which of these would happen, as normally in a grapple the grappled creature cannot ever move. (And I might be confusing myself by trying to think of how this would even work IRL.)

Using fog cloud to increase archer range

Longbow archers can attack up to 600 ft but would do so at disadvantage. However if they would first walk into a fog cloud and then shoot, they would roll normal based on this question. Because advantage and disadvantage cancel out. Since advantage and disadvantage caused in a heavy obscured area cancel out, what effect does it have in combat?

It seems weird that one could quadruple the standard range of archers by casting fog cloud on them. Is that really RAW?

(next round the archers would probably have to walk out of the fog cloud to reaquire their target and walk back into it with their movement, otherwise they may be targeting the wrong square.)

Unity 2D: Can’t resolve ArgumentOutOfRangeException: Index was out of range

I am very much a novice to coding with no background on this at all so the code you see here may be terrible.

Basically I’m making an endless runner, made up of a player character and a set of obstacle prefabs. The obstacle prefabs have a trigger on them so that when the player hits it, it spawns the next prefab. I’m using the code below, and when the player hits the first spawn trigger it will spawn a prefab, but on tripping the next trigger it gives me the ArgumentOutOfRangeException error in the console and doesn’t spawn anything.

public class ObsTrigger : MonoBehaviour {

 public GameObject spawnTrigger;  [SerializeField] private List<Transform> obstacleList;   private void OnTriggerEnter2D(Collider2D other)  {      if (other.CompareTag("Player"))      {          for (int i = 0; i < obstacleList.Count; i++)          {              spawnObstacle();          }      }  }   public void spawnObstacle()  {      {          Transform chosenLevelPart = obstacleList[Random.Range(0, obstacleList.Count -1)];          Instantiate(chosenLevelPart);      }  } 


If anyone can point me in the right direction I would really appreciate it!

Efficiently populate a look-up table for a function over a range of arguments in Python

I am minimizing a scalar function which takes a n-dimensional vector input and outputs the scalar value, n-dim vector (Jacobian), and an nxn matrix (Hessian). Given a range of the elements in my input vector I’m looking for a efficient way to precalculate the outputs in an efficient to access format.

I’ve been thinking of a scheme based on numpy.interpn with a regularly spaced grid of inputs, but this only allow for linear interpolation of intermediate values, and requires regular sampling.

I’m hoping there is a tool available that does this with a more intelligent method? Perhaps with automatic refinement of inputs sampled or a more sophisticated interpolation scheme?

Technically, the scalar output contains the Jacobian and Hessian but I need those with decent fidelity, so I would either need a higher order representation of the scalar function (with added sampling frequency) or I ccan interpolate on the Jacobian and Hessian directly (as they are outputted by the minimizer anyway)