## Replacing Merfolk Tail with Salamander Bloodline

Merfolk are a powerful race that are balanced out by their poor land movement resulting from possessing a tail instead of legs:

Base Speed (Slow Speed): Merfolk have a base speed of 5 feet. They have a swim speed of 50 feet.

Legless: Merfolk have no legs, and therefore cannot be tripped.

Merfolk have the upper torsos of well-built and attractive humans and lower halves consisting of the tail and fins of a great fish.

The salamander bloodline for the bloodrager class replaces the "legs" with a tail. This tail is different from the merfolk tail in that it is better suited to land:

Serpent’s Tail (Su) At 1st level, your legs twist together into a slithering serpentine tail. Your speed is reduced by 10 feet (to a minimum of 5 feet), and you can’t be tripped.

Your footwear melds into your body and is nonfunctional unless it provides a constant bonus and does not need to be activated. You also gain a tail slap natural attack that deals 1d6 points of damage (1d4 if you are Small) + your Strength modifier. At 4th level, your speed is no longer reduced by 10 feet. At 8th level, your tail slap’s damage increases to 1d8 (1d6 if you are Small) + your Strength modifier. At 12th level, your reach with your tail slap increases by 5 feet.

If my race is merfolk, and I make use of the bloodrager salamander bloodline, can I replace the merfolk locomotion with the salamander locomotion completely?

## Replacing Command words with sounds, (Like snapping your fingers)

Is it possible to replace a command word, for say a wand, or a flaming longsword, to react to a fingersnap or similar sound instead of an actual spoken word?

## Replacing \$x,y\$ in \$f(x,y,z)\$ with values from a list

I’m sure there is a simple solution to this using map or apply, but its not occurring to me.

Suppose I have a function $$f(x,y,z)= x+y+z)$$

And I want to evaluate $$f(x,y,1)$$ for $$\{x,y\} ∈ \{\{1,2\},\{3,4\}\}$$

What is the best way to do this?

Examples:

If I use `f[x_,y_,z_]:= x+y+z; f[#1,#2,1]&/@ {{1,2},{3,4}}`

this will give me things like `{{2+#2,3+#2}}.`

On the other hand, `Apply` works on a single element `f[#1,#2,1]& @@ {1,2}` but not on a list such as `{{1,2},{3,4}}`. On the list it gives me `{f[1,3,1],f[2,4,1]`

I am not sure how to go from the case of a single pair to a list of pairs

## Portent feature: is it replacing only the d20 roll or the final outcome?

The divination wizard’s Portent ability states (emphasis mine)

You can replace any attack roll, saving throw, or ability check made by you or a creature that you can see with one of these foretelling rolls. You must choose to do so before the roll, and you can replace a roll in this way only once per turn.

The PHB (pag 7, "The D20", 3rd paragraph) describes saving throws, attack rolls and ability checks as

[…] the three main kinds of d20 rolls, forming the core of the rules of the game.

All three of them consists of a d20 roll and then modifiers are applied to this die roll. The description of Portent is quite foggy: the first sentence suggests that it allows to replace the final result (d20+mods), while the second part of the description mentions the roll, without specifying if it just refers to the d20 roll or to d20+mods.

Is Portent allowing the wizard to replace the final result or just the d20 roll?

This topic is covered in several answers and questions related to Portent working with other rules/aspects of the game: these report some tweets by Jeremy Crawford. On one hand, the Sage Advice Compendium ("Official Ruling" section) states they are not considered official anymore, on the other hand in the very same section is stated that they could be a preview of rulings that will appear here [i.e. in Sage Advice]. Jeremy’s tweet about this issue have not been still included in any version of Sage Advice Compendium, at the best of my knowledge.

## How would I go about replacing this function in my child theme located in inc/template-tags.php

How would I replace this function that lies inside `inc/template-tags.php` in my parent theme

``function theme_navigation() { ?>                  <div id="theme-nav-container">             <nav id="site-navigation" class="main-navigation">                 <?php wp_nav_menu( array('theme_location' => 'theme-studios-primary', 'menu_class' => 'sf-menu', 'fallback_cb' => false, 'walker'  => new theme ) ); ?><div class="clearfix-pro"></div>             </nav>             <div class="clearfix-pro"></div>         </div>                  <!-- close #theme-nav-container -->                   <?php } ``

There is no add action that it is hooked on to, there is no check to see if the function already exists. How would I replace it without touching the parent theme. I have removed much of the code in the function for brevity but I think it still makes sense.

## Replacing dead hirelings in Pathfinder downtime system

I am currently pricing up the cost of running a mercenary guild for a game I am assisting with (GM for downtime).

I’ve combined Guildhall and Barracks (while removing duplicates between building types) and placed a Mercenary Company organization in it.

Given the way the player in question plays, sooner or later he is going to get some of his Elite Soldiers and Elite Archers killed off. What would be the best way to handle replacing lost men?

The best I can think of would be to charge 1/5 of the cost per lost man from the unit and deny earnings from that unit until fully restocked. Or would it be better to say that it takes one week per lost man to “heal” through recruitment? I want to strongly discourage using 3rd level characters as cheap disposable meat shields.

Are there actual mechanics for this situation that I have missed and if not is my approach the best idea?

## Replacing a code in various pages at same time – HTML

I have a lot of pages of code on a site and one of this has a problem. I’d like to past and replace the code to another, but without having to go through each of the hundreds of pages. How can I do this? Many thanks!

## What would be the ramifications of replacing Multiattack with Extra Attack?

There are a lot of questions on “Extra Attack vs Multiattack” and it’s become my opinion that the act of separating the two generates more confusion than value as a gameplay and balancing lever.

It seems that the main reason Extra Attack and Multiattack are distinct is because it prevents monsters with Multiattack from utilizing the all-too-common shove/attack sequence that Extra Attack PCs utilize… but seeing as most monsters lack proficiency in Athletics they’ll lose the contest almost any time they attempt it, so I don’t see how that could be a worthy balance consideration.

I’m considering implementing a house rule that treats Multiattacks as Extra Attacks. Any time that a monster is able to attack multiple times, the attacks are treated as separate attacks granted through the Extra Attack feature. Specific text that limits the number of a particular attack per multiattack is still respected (eg. A young red dragon is given three attacks, two of which can be a claw attack, one of which can be a bite attack).

What would be the balance ramifications of this house rule?

## Replacing derivative of a function

I want to replace the time derivative (only time derivative part) of a function with another function. If the term has also a derivative with x (space), how can I do it? I tried the following but that results in Binomial function:

If I have:

``{Derivative[0, 1][u][x, t] -> (\[Lambda]*(3*u[x, t]^2*Derivative[1, 0][u][x, t]^2 + u[x, t]^3*Derivative[2, 0][u][x, t]))/3} ``

All what I want is to take the nx- derivative of the right hand side of the rule, I tried the following but it resulted in Binomial function:

``   repRule={Derivative[nx_, 1][u][x, t] -> D[(\[Lambda]*(3*u[x, t]^2*Derivative[1, 0][u][x, t]^2 + u[x, t]^3*Derivative[2, 0][u][x, t]))/3, {x, nx}]} ``

And when I apply it to a simple expression like:

``ss=\!\(\*SuperscriptBox[\(u\),  TagBox[  RowBox[{"(",   RowBox[{"1", ",", "1"}], ")"}],  Derivative],  MultilineFunction->None]\)[x, t] ``

I get from ss/.repRule:

``     (\[Lambda]*(3*Inactive[Sum][Binomial[1, K[1]]*D[Derivative[1, 0][u][x, t]^2, {x, 1 -       K[1]}]*Inactive[Sum][u[x, t]*Derivative[K[1], 0][u][x, t], {K[1], 0, K[1]}],   {K[1], 0, 1}] + Inactive[Sum][Binomial[1, K[1]]*D[Derivative[2, 0][u][x, t], {x, 1 - K[1]}]*  Inactive[Sum][D[u[x, t], {x, -K[2]}]*Multinomial[K[1], -K[2], K[2]]*Derivative[K[1], 0][u][x, t]*Derivative[K[2], 0][u][x, t], {K[1], 0, K[1]}, {K[2], 0, K[1]}],  {K[1], 0, 1}]))/3 ``

Your help is much appreciated. Thanks

## Replacing 0x1021 polynomial with 0x8005 in this CRC-16 code

I have some highly optimized code for a CRC-16 implementation. It focuses on speed rather than flexibility, and as a result, it is hard-coded to model the specific unreflected polynomial `0x1021`, or x^12 + x^5 + x^0.

Using the same general approach (with slight modification), I was able to represent the reflected variant of this polynomial as well, which is `0x8408`, or x^15 + x^10 + x^3. This is achieved by changing bit shift direction as well as the polynomial shifts.

Now, I am wondering if it is possible to use this same approach to use other polynomials, specifically `0x8005`, or x^15 + x^2 +x^0. To do so I need to understand what this code is doing, but I haven’t quite figured it out yet. This is a essentially an edge case of CRC, amounting to clever usage of bitwise optimizations.

Here is the code for the unreflected CRC using polynomial `0x1021`:

``// in JavaScript, but easily translates to C etc. function crc16(data, crc = 0, xorout = 0) {     for(let i = 0, t; i < data.length; i++, crc &= 0xFFFF) {         t = (crc >> 8) ^ data[i]; // shift high crc byte over         t = (t ^ t >> 4);         crc <<= 8; // shift left 1 byte         crc ^= (t << 12) ^ (t << 5) ^ (t);     }     return crc ^ xorout; } ``

This can model CRC-16 variants such as XMODEM or “CCITT-FALSE” depending on the initial value of `crc` and `xorout`.

The `crc` variable stores the current CRC value, while the `t` variable is temporary storage for intermediate calculations. The expression `(t << 12) ^ (t << 5) ^ (t)` appears to model the actual polynomial, which gets XOR’d into the CRC for every byte of input.

For `0x8005`, also an unreflected polynomial, one might assume a drop in replacement such as `(t << 15) ^ (t << 2) ^ (t)` would do the trick, but it does not appear to give the correct output.

As I said before, I was able to correctly model the reflected version of `0x1021` as well using this construction. Here is the code for that:

``function crc16b(data, crc = 0, xorout = 0) {     for(let i = 0, t; i < data.length; i++, crc &= 0xFFFF) {         t = (crc) ^ data[i];         t = (t ^ t << 4) & 255; // &255 is to remove overflow         crc >>= 8; // shift right 1 byte         crc ^= (t << 8) ^ (t >> 4) ^ (t << 3);     }     return crc ^ xorout; } ``

This code correctly models the reflected variants such as CCITT-TRUE, ISO/IEC 14443 among others.

The code is slightly different to account for it being reflected, but the structure is essentially the same. However the expression that represents the polynomial is a bit strange: `(t << 8) ^ (t >> 4) ^ (t << 3)`. It doesn’t seem to line up with the expected polynomial representation x^15 + x^10 + x^3.

The polynomial I want to translate to this structure is `0x8005` (or its reflected version, `0xA001`). It has both reflected and unreflected variants. I am referencing the different CRC-16 variants and vectors from here: http://reveng.sourceforge.net/crc-catalogue/16.htm

This page uses a test string “123456789”, to check implementation correctness, so I typically check it as an array:

``crc16([49, 50, 51, 52, 53, 54, 55, 56, 57]) ``

And these are the expected values for two CRC-16 variants I am targeting (which use `0x8005` polynomial or `0xA001` reversed):

``For init=0x0000 and xorout=0x0000 ---------------------------------- CRC-16/UMTS (unreflected) = 0xfee8 CRC-16/ARC  (reflected)   = 0xbb3d ``

What I want to do is modify the above code to implement the polynomials `0x8005` and `0xA001`, but I’m having trouble figuring out how it even works in the first place. I figured `0x8005` would be a good fit because of the few number of bits which are used.

Any ideas on how this is actually implementing CRC-16, or what might be required to translate other polynomials?

A classic resource on CRC is A Painless Guide to CRC Error Detection Algorithms

Also if it helps, here are traditional implementations of CRC-16 (but are less efficient):

These implementations allow any polynomial to be supplied as input. Here is the unreflected version:

``// Targets XMODEM var crc16 = function(data) {     var POLY = 0x1021, INIT = 0, XOROUT = 0;     for(var crc = INIT, i = 0; i < data.length; i++) {         crc = crc ^ (data[i] << 8);         for(var j = 0; j < 8; j++) {             crc = crc & 0x8000 ? crc << 1 ^ POLY : crc << 1;         }     }     return (crc ^ XOROUT) & 0xFFFF; }; ``

And the reflected equivalent (notice the change of shift direction…):

``// Targets KERMIT var crc16b = function(data) {     var POLY = 0x8408, INIT = 0, XOROUT = 0;     for(var crc = INIT, i = 0; i < data.length; i++) {         crc = crc ^ data[i];         for(var j = 0; j < 8; j++) {             crc = crc & 1 ? crc >> 1 ^ POLY : crc >> 1;         }     }     return (crc ^ XOROUT) & 0xFFFF; }; ``