Who picks the type of the Basic Attack?

Charm of Misplaced Wrath (Heroes of Fallen Lands, p206)

The target makes a basic attack against a creature of your choice as a free action. The basic attack gains a +2 power bonus to the damage roll.

This is a 1st level Wizard encounter power, if it matters.
Can I make the target do a Ranged Basic Attack (so it provokes attacks of opportunity) or does it get to pick the type of Basic Attack?

What is the appropriate way to represent type attribute of one entity in a conceptual model?

I have a vehicle entity, and this vehicle can be of different types. How a model this in a conceptual design?, I place the type as an attribute of the vehicle entity? and if each vehicle has its own set of attributes, how do I model each vehicle type if it is already as a vehicle attribute?

Save the post parent in a custom post type in Gutenberg

A plugin I’m developing registers two custom post types: Class and Student. Both are connected via the post_parent property in the Student post type (one student belongs to one class). I added a SelectControl control to the PluginDocumentSettingPanel in the Student post type edit screen to be able to set a Class for the Student. Everything is working except the saving part. The changes are not saved. Any ideas?

Thanks in advance

const { __ } = wp.i18n; const { compose } = wp.compose; const { registerPlugin } = wp.plugins; const { SelectControl } = wp.components; const { PluginDocumentSettingPanel } = wp.editPost; const { withSelect, withDispatch } = wp.data;  const applyWithSelect = withSelect( ( select ) => {     const {         getEditedPostAttribute,         getCurrentPostType     } = select( 'core/editor' );     const {         getEntityRecords     } = select( 'core' );      const parent = getEditedPostAttribute( 'parent' );      const posts = getEntityRecords( 'postType', 'class', { per_page: -1, orderby: 'title', order: 'asc', _fields: 'id,title' } )      return {         currentPostType: getCurrentPostType(),         parent: parent,         posts: posts     }; } );  const applyWithDispatch = withDispatch( ( dispatch ) => {     const { editPost } = dispatch( 'core/editor' );      return {         onUpdateParent( value ) {             editPost( { parent: Number( value ) } );         },     }; } );  function StudentOptionsPanelComponent( {     // These props are passed by applyWithSelect().     currentPostType, // current post type     parent, // current value of parent     posts, // all posts     // And these are passed by applyWithDispatch().     onUpdateParent,  // function which updates the meta restrict } ) {     if ( 'student' !== currentPostType ) {         return null;     }      if ( ! posts ) {         return __( 'Loading...', 'my-plugin' );     }      if ( posts.length === 0 ) {         return __( 'No classes found', 'my-plugin' );     }      var options = [];     options.push( {         label: __( 'Select a class...', 'my-plugin' ),         value: ''     } );      for ( var i = 0; i < posts.length; i++ ) {         options.push( {             label: posts[i].title.raw,             value: posts[i].id         } );     }      return (         <PluginDocumentSettingPanel             name='student-options'             title={ __( 'Options', 'my-plugin' ) }             className='student-options-panel'         >             <SelectControl                 label={ __( 'Select a class:', 'my-plugin' ) }                 value={ parent }                 options={ options }                 onChange={ onUpdateParent }             />         </PluginDocumentSettingPanel>     ); }  const StudentOptionsPanel = compose(     applyWithSelect,     applyWithDispatch )( StudentOptionsPanelComponent );  registerPlugin( 'student-options-panel', {     render: StudentOptionsPanel, } ); 

Limit custom post type to the authors only on front-end!

I’m trying to limit the custom-post-types to their authors excluding administers on the homepage. This is how the code looks like on the homepage.php

  <?php             $  args = array(           'post_type' => 'project',           'post_status' => 'publish'           );            $  post_query = new WP_Query ( $  args ); ?>            <?php while($  post_query->have_posts()):$  post_query->the_post(); ?>       //display post type content            <?php endwhile; ?> <?php wp_reset_postdata(); ?> 

I tried using the code below, that almost achieved what i wanted but it is giving an unusual 404 error instead of the homepage for the new users(authors) but works absolutely fine when logged-in as administrator or from old author’s profile before adding this code.

// limit post display to post authors function limit_post_to_only_author($  query) {     global $  current_user;     if (!current_user_can('manage_options')) {         $  query->set('author', $  current_user->ID);     } } add_action('pre_get_posts', 'limit_post_to_only_author'); 

I’ve posted a question with detailed explanation about the issue that the above code is causing here. but would prefer a solution to limit the post to authors on the frontend…

Substitution of monomorphic type variables in generalized Hindley–Milner

I am trying to understand the constraints-based Hindley–Milner type inference algorithm described in the Generalizing Hindley-Milner paper. The function $ \text{S}\small{\text{OLVE}}$ is defined as follows:

$ $ \begin{array}{l} \text{S}\small{\text{OLVE}} :: Constraints → Substitution \ \text{S}\small{\text{OLVE}} (\emptyset) = [\ ] \ \text{S}\small{\text{OLVE}} (\{ \tau_1 \equiv \tau_2 \} \cup C) = \text{S}\small{\text{OLVE}} (\mathcal{S} C) \circ \mathcal{S} \ \quad \quad \quad \text{where}\ \mathcal{S} = \text{mgu}(\tau_1, \tau_2) \ \text{S}\small{\text{OLVE}} (\{ \tau_1 \leq_M \tau_2 \} \cup C) = \text{S}\small{\text{OLVE}} (\{ \tau_1 \preceq \text{generalize}(M, \tau_2) \} \cup C) \ \quad \quad \quad \text{if}\ (\text{freevars}(\tau_2) − M) \cap \text{activevars}(C) = \emptyset \ \text{S}\small{\text{OLVE}} (\{ \tau \preceq \sigma \} \cup C) = \text{S}\small{\text{OLVE}} (\{\tau \equiv \text{instantiate}(\sigma)\} \cup C) \ \end{array} $ $

Most of this is clear, but where I am confused is around how substitution is defined for the monomorphic set $ M$ . The paper explains that

For implicit instance constraints, we make note of the fact that the substitution also has to be applied to the sets of monomorphic type variables.

$ $ S(\tau_1 \leq_M \tau_2) =_{def} \mathcal{S} \tau_1 \leq_{\mathcal{S} M} \mathcal{S} \tau_2 $ $

but I don’t find any details of how $ \mathcal{S} M$ is defined. Based on Example 3, I think we should get something like:

$ $ \text{S}\small{\text{OLVE}} (\{\tau_4 \leq_{\{ \tau_1 \}} \tau_3, \text{Bool} \rightarrow \tau_3 \equiv \tau_1 \}) \ = \text{S}\small{\text{OLVE}} (\{\tau_4 \leq_{\{ \tau_3 \}} \tau_3 \}) \circ[\tau_1 := \text{Bool} \rightarrow \tau_3] $ $

In this step, unifying $ \text{Bool} \rightarrow \tau_3 $ and $ \tau_1 $ gives a substitution $ \mathcal{S} = [ \tau_1 := \text{Bool} \rightarrow \tau_3 ] $ , and $ M = \{ \tau_1 \} $ , and so apparently $ \mathcal{S} \{ \tau_1 \} = \{ \tau_3 \} $ , but how do we arrive at that? Maybe there is something obvious I have overlooked here.

Can Homotopy Type Theory be used to derive more efficient algorithms on more efficient data representations from less efficient ones?

I’ve read here that in HoTT, compilers could swap out less efficient representations of data for more efficient ones and I’m wondering whether my interpretation of this statement is correct.

Say we have two different ways of representing the natural numbers, unary (zero and successor) and binary. Here is a function that checks evenness on the former representation:

even : UnaryNat -> Bool even zero = true even (succ zero) = false even (succ (succ n)) = even n 

If we then have an isomorphism between the unary and binary representations, we trivially get an evenness function for the binary representation “for free”, simply by converting a given binary natural number to a unary one, applying the even function, and converting the result back to the binary representation. Obviously, this is not very efficient, and we also don’t need HoTT for this.

A better way to check whether a binary natural number is even would be to check if its least significant digit is a zero. My question is: Could we derive this more efficient algorithm for binary natural numbers from our definition of evenness for unary natural numbers using HoTT? If so, would this also be possible for other data types? I haven’t studied any HoTT yet and since its appears to be a pretty complex subject I would like to find out whether it’s as exciting as I think it is. Thanks!

What happens when a creature with vulnerability to a damage type has resistance to the same type imposed on it, or vice versa?

So, let’s imagine for a moment that two Fiend-patron Warlocks are fighting. One uses its Fiendish Resilience to get resistance to fire damage, but the other one casts the Hallow spell with the Energy Vulnerability effect to impose vulnerability to fire damage.

The description of the Fiendish Resilience feature:

Fiendish Resilience: Starting at 10th level, you can choose one damage type when you finish a short or long rest. You gain resistance to that damage type until you choose a different one with this feature. Damage from magical weapons or silver weapons ignores this resistance. (PHB 109)

And the extra effect of Hallow:

Energy Vulnerability: Affected creatures in the area have vulnerability to one damage type of your choice, except for bludgeoning, piercing, or slashing. (PHB 249)

Which trumps which in this scenario? Or do they cancel out and result in standard (1x) damage?

I’m sorry if this has already been asked; I didn’t see anything like it in the “Related Questions” or “Similar Questions” sections.

Also, bonus points:

  • If imposed vulnerability/resistance trumps innate vulnerability/resistance, how does it interact with immunity?