dnd 5e – Dhampir bite attack, does it add both STR and CON?

The Vampiric Bite, from the new Dhampir lineage race, says as follow (emphasis mine):

Vampiric Bite

“Your fanged bite is a natural weapon, which counts as a simple melee weapon with which you are proficient. You add your Constitution modifier to the attack and damage rolls when you attack with your bite. Your bite deals 1d4 piercing damage on a hit. While you are missing half or more of your hit points, you have advantage on attack rolls you make with this bite.”

Normally, a simple melee weapon attack works as follow:

Attack Rolls

To make an Attack roll, roll a d20 and add the appropriate modifiers.

Modifiers to the Roll

Ability Modifier
The ability modifier used for a melee weapon Attack is Strength, and the ability modifier used for a ranged weapon Attack is Dexterity.(…)

Proficiency Bonus
You add your Proficiency Bonus to your Attack roll when you Attack using a weapon with which you have proficiency, as well as when you Attack with a spell.

This translates into rolling 1d20 + STR modifier + Proficiency bonus.

Does it mean that a Vampiric Bite attack adds CON modifier to the above formula (1d20 + STR mod + Proficiency bonus + CON mod)?

Same question for the damage roll:

Damage rolls

When attacking with a weapon, you add your ability modifier—the same modifier used for the Attack roll—to the damage.

Normally for a melee weapon the attack formula is (weapon-damage-die) + STR modifier.
If another modifier is used, instead of the usual one, the wording is different from what we see in the Vampiric Bite. An example is Finesse weapons, which say as follow:

Finesse

When Making an Attack with a finesse weapon, you use your choice of your Strength or Dexterity modifier for the Attack and Damage Rolls. You must use the same modifier for both rolls.

Is it correct to say that, unlike Finesse weapons, the Vampiric bite does not replace the STR modifier with CON, but rather adds both (making the damage formula 1d4 (weapon-dmg-die) + STR modifier + CON modifier)?

python – AttributeError: ‘str’ object has no attribute ‘num_points’

Estou tentando criar um coletor de dados de um experimento que eu estou fazendo. Até o momento eu tenho o seguinte código:

em um arquivo experiments.py tem a classe:

import csv

class Experimento:
        
       def __init__(self, material: str, num_points: int, time: float=20.0, expType: str='varredura'):
            
            if expType not in ('varredura','ponto fixo'):
                raise ValueError('Tipo de experimento inválido. Selecione entre Varredura ou Ponto Fixo. n NOTA: não utilize letras maiúsculas!')
            
            self.num_points = num_points
            self.time = time
            self.material = material
            self.expType = expType

E a subclasse:

class Ponto_Fixo(Experimento):
    
    def __init__(self, material: str, num_points: int, x: int, z: int, time: float=20.0):
        Experimento.__init__(material, num_points, time, 'ponto fixo')
        self.x = x
        self.z = z
        self.expID = material + ' x' + str(self.x) + ' z' + str(self.z) + ' pt=' + str(num_points)
        
        header = ('data','material','ponto','x','z','contagem','tempo(s)')
        
        csv_title = '%s.csv' %(self.expID)
        with open('resultados'+ csv_title,'w') as file:
            writer = csv.writer(file)
            writer.writerow(header)

No main.py, eu executo esse código assim:

import experiments

if __name__ == "__main__":
    material = 'agua+CaCO3'
    expType = 'ponto fixo'
    tempo = 20.0
    num_points = 6
    x = 2
    z = 2

def new_experiment(material, num_points, tempo, x, z, expType):
        
    if expType == 'ponto fixo':
        
        experiments.Ponto_Fixo(material, num_points, x, z, tempo)
        
novo_exp = new_experiment(material, num_points, tempo, x, z, expType)

Porém, ao fazer essa execução eu obtenho o erro do título

  File "C:AdamDoutoradoLaboratorioTARGprogramsdata collectionmain.py", line 46, in <module>
    novo_exp = new_experiment(material, num_points, tempo, x, z, expType)

  File "C:AdamDoutoradoLaboratorioTARGprogramsdata collectionmain.py", line 37, in new_experiment
    experiments.Ponto_Fixo(material, num_points, x, z, tempo)

  File "C:AdamDoutoradoLaboratorioTARGprogramsdata collectionexperiments.py", line 113, in __init__
    Experimento.__init__(material, num_points, time, 'ponto fixo')

  File "C:AdamDoutoradoLaboratorioTARGprogramsdata collectionexperiments.py", line 37, in __init__
    self.num_points = num_points

AttributeError: 'str' object has no attribute 'num_points'

A linha que o programa acusa o erro é essa (que está dentro da classe Experimento):

self.num_points = num_points

Além disso, a linha que troca a tipagem da variável num_point de int para str está depois dessa linha do erro. Logo, não estou conseguindo enxergar onde e porque está ocorrendo a troca do tipo de int para str no num_point.

Alguém consegue dar uma luz?
Obrigado

pathfinder 1e – Do pouncing animal companions get STR modifier bonuses to Rake attacks?

Yes, your lion’s rake attacks gain its STR mod as a bonus to damage.

From the AONPRD on Rake (emphasis mine):

A creature with this special attack gains extra natural attacks under certain conditions, typically when it grapples its foe. In addition to the options available to all grapplers, a monster with the rake ability gains two free claw attacks that it can use only against a grappled foe. The bonus and damage caused by these attacks are included in the creature’s description.

First, note that the rake attacks are claw attacks. Claw attacks are primary natural attacks that gain your full STR bonus to damage.

From the AONPRD on natural attacks:

Most creatures have natural attacks (attacks made without a weapon). These attacks can be primary or secondary attacks. Primary attacks are made using the creature’s full base attack bonus and add the creature’s full Strength bonus to damage rolls. Secondary attacks are made using the creature’s base attack bonus – 5 and add only 1/2 the creature’s Strength bonus to damage rolls.

The second emphasized part of the description of the Rake special ability may cause some concern, as it implies that the bonus should be listed in the animal’s stat block, and no such bonus is listed for the big cat animal companion. However, this concern is negated by the fact that no bonus is listed for any animal companion’s natural weapons; because animal companions increase their strength score as their master gains levels, their bonus changes over time. Thus, animal companion stat blocks only include the base damage die for natural attacks, and leave calculating other bonuses to the player.

This can be seen in the animal companion lion’s stat block listing no bonus for rake (or bite, or claw) attacks, while the monster lion’s stat block does list bonuses for all of its natural attacks, including the rake attacks.

python – Split int and str discord.py

i want to make tempmute command in my discord bot, and one this is annoying for me. If i want to use my mute command i need to use “mute @member time s/m/h/d reason”, I want to remove space between “time” and “s/m/h/d”.

Duration is “s/m/h/d”.

I’m trying to use split(), but it isn’t working, or I’m an idiot.

Thank you in advance

Here’s my code:

    @commands.command()
    @commands.has_permissions(kick_members=True)
    async def mute(self, ctx, member: discord.Member, time=0, duration=None, *, reason=None):
        if member.id == ctx.author.id:
            await ctx.send(f"{ctx.author.mention}, you can't mute yourself!")

        if reason == None:
            reason = "no reason provided"
        

        role = discord.utils.get(ctx.guild.roles, name="Muted")
        if role in ctx.guild.roles:
            if time == 0:
                    embed = discord.Embed(
                        title=":white_check_mark: Success!",
                        description=f"Successfully muted <@{member.id}>",
                        colour=discord.Colour.from_rgb(66,164,245),
                        timestamp=ctx.message.created_at
                    )
                    embed.add_field(name="Reason:", value=f"{reason}")
                    embed.set_footer(text=f"{ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator})")
                    uembed = discord.Embed(
                        title=f"You've been muted on `{ctx.guild.name}`",
                        colour=discord.Colour.from_rgb(66,164,245),
                        timestamp=ctx.message.created_at
                    )
                    uembed.add_field(name="Reason:", value=f"{reason}")
                    uembed.set_footer(text=f"{ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator})")
                    await ctx.message.delete()
                    await member.add_roles(role, reason=f"Muted by: {ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator}), Reason: {reason}")
                    await ctx.send(embed=embed)
                    await member.send(embed=uembed)
                    return
            else:
                embed = discord.Embed(
                    title=":white_check_mark: Success!",
                    description=f"Successfully muted <@{member.id}>",
                    colour=discord.Colour.from_rgb(66,164,245),
                    timestamp=ctx.message.created_at
                )
                embed.add_field(name="Duration:", value=f"{time}{duration}")
                embed.add_field(name="Reason:", value=f"{reason}")
                embed.set_footer(text=f"{ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator})")
                uembed = discord.Embed(
                    title=f"You've been muted on `{ctx.guild.name}`",
                    colour=discord.Colour.from_rgb(66,164,245),
                    timestamp=ctx.message.created_at
                )
                uembed.add_field(name="Duration:", value=f"{time}{duration}")
                uembed.add_field(name="Reason:", value=f"{reason}")
                uembed.set_footer(text=f"{ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator})")
                if duration == "s":
                    time = time*1
                elif duration == "m":
                    time = time*60
                elif duration == "h":
                    time = time*3600
                elif duration == "d":
                    time = time*86400
                else:
                    await ctx.send("Error! Use s/m/h/d")
                await ctx.message.delete()
                await member.add_roles(role, reason=f"Muted by: {ctx.author.display_name} ({ctx.author.name}#{ctx.author.discriminator}), For time: {time}{duration}, Reason: {reason}")
                await ctx.send(embed=embed)
                await member.send(embed=uembed)
                await asyncio.sleep(time)
                await member.remove_roles(role, reason="Time is up")
                return
        else:
            await ctx.send(":x: No role name `Muted` found in `guild.roles`!n**Bot'll make it!** Don't do anything!")
            guild = ctx.guild
            await guild.create_role(name="Muted")
            role = discord.utils.get(guild.roles, name="Muted")
            for channel in guild.channels:
                await channel.set_permissions(role, send_messages=False)
                await ctx.send("Mute user again!")
                return

dnd 5e – Is an unarmed human with STR 7 incapable of killing someone?

A human has no natural attacks, so I’ll use him, but any humanoid character without damage features works too. No magic. Let’s exclude any character class that can earn a damage bonus. Monk, barbarians, etc…

Anyone can do an unarmed melee attack. It deals 1 + STR modifier bludegoning damage.

An unarmed person with STR 7 should do 1 minus 2 damage. Nothing. Even if it is a critical.

Is the person above unable to kill anything in combat without a weapon?

Regarding the concerns about the purpose of the question:

Are you only interested in killing via reduction of HP? I.e. are you looking for ways to kill as an unequipped weakling, or are you looking to confirm your reading of low-STR unarmed strikes? – nitsua60♦

Kill can be achieved by any combat option that does not involve the use of weapons (improvised or otherwise) or environment. Does not have and cannot pickup any object.

  • Looking for ways to kill as an unequipped weakling, without class features.

Como transformar uma lista de numeros em formato str para um array? Python

Obrigado por contribuir com o Stack Overflow em Português!

  • Certifique-se de responder à pergunta. Entre em detalhes sobre a sua solução e compartilhe o que você descobriu.

Mas evite

  • Pedir esclarecimentos ou detalhes sobre outras respostas.
  • Fazer afirmações baseadas apenas na sua opinião; aponte referências ou experiências anteriores.

Para aprender mais, veja nossas dicas sobre como escrever boas respostas.

Django – Incorrect type. Expected pk value, received str

I have 2 django models: Post and Comment:

class Post(models.Model):
    user        = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    title       = models.CharField(max_length=120)

class Comment(models.Model):
    user        = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
    content     = models.CharField(max_length=120)
    post        = models.ForeignKey(Post,on_delete=models.CASCADE)

class PostCommentCreateView(APIView):
    queryset                = Comment.objects.all()
    serializer_class        = PostCommentCreateSerializer

    def get(self, request, format=None, *args, **kwargs):
        serializer          = PostCommentCreateSerializer()
        return Response({'serializer':serializer.data})
        
    def post(self, request, *args, **kwargs):
        post                = int(self.kwargs('postid'))
        print(post) #1
        comment_data        = request.data 
        data_               = (elem for elem in comment_data.values())
        content             = data_(0)
        csrf                = data_(1)
        user                = request.user.username
        new_comment         = {'user':user,'content':content,'post':post, 'csrfmiddlewaretoken':csrf}
        commentdict         = QueryDict('', mutable=True)
        commentdict.update(new_comment)
        serializer          = PostCommentCreateSerializer(data=new_comment)
        if not serializer.is_valid():
            return Response({'data':serializer.errors})
        serializer.save()
        userimage           = request.user.profile.image.url
        resp_data = {
            'user':user,
            'userimage':userimage,
            'content':content
        }
        return Response({'data':resp_data}) 

class TrackCommentCreateSerializer(serializers.ModelSerializer):
    class Meta:
        model = Comment
        fields = ('user','content','post')

When I try to post a comment with the post id, I get an error that a pk value is expected and not a string.


Thank you for any suggestions

python 3.x – ¿Como corregir error de concatenar str en python3?

Estoy corriendo el siguiente fraagmento de codigo de un paquete de ROS llamado canusb

el cual se puede ver a continuacion:

def readline(self):
    """
    Overrides io.RawIOBase.readline which cannot handle with 'r' delimiters
    """
    ret = ''
    while True:
        c = self.read(1)
        if c == '':
            return ret
        elif c == 'r':
            if ret == 'z' or ret == 'Z':
                self.status = 0
            return ret + c
        elif c == chr(7):
            self.status = -1
            return c
        else:
            ret += c

Me esta saltando el siguiente error de la ultima linea:

Traceback (most recent call last):
  File "/home/pi/catkin_ws/src/canusb/script/canusb.py", line 191, in <module>
    can.init()
  File "/home/pi/catkin_ws/src/canusb/script/canusb.py", line 57, in init
    line = self.readline()
  File "/home/pi/catkin_ws/src/canusb/script/canusb.py", line 51, in readline
    ret += c
TypeError: can only concatenate str (not "bytes") to str

¿Como se puede solucionar?

Un saludo y muchas gracias con antelación.
Alessandro

dnd 5e – Would it be unbalanced for Dex-based Fighters to choose proficiency in Dex saving throws instead of Str saving throws?

The three common saving throws are DEX, CON, and WIS. The three uncommon saving throws are STR, INT, and CHA. Every character class gets proficiency in one of the three common saves and one of the three uncommon saves. For example, the Fighter gets CON as its common save and STR as its uncommon save.

If you allowed the Fighter to replace STR with DEX, they would then have DEX and CON saves, which are both common saves, making them far better at saving throws than other characters. This would overpower the Fighter relative to other characters.

The following are the saving throw proficiencies for each class, grouped by those classes with the same proficiencies. What you can do is allow your Fighter to take both proficiencies from another class with a DEX save instead of those from the Fighter class.

  • Barbarian & Fighter: STR, CON
  • Bard: DEX, CHA
  • Cleric, Paladin, & Warlock: WIS, CHA
  • Druid & Wizard: INT, WIS
  • Monk & Ranger: STR, DEX
  • Rogue: DEX, INT
  • Sorcerer: CON, CHA

In your case, you could allow the Fighter to take DEX and CHA saves (like a Bard), STR and DEX saves (like a Monk or Ranger), or DEX and INT saves (like a Rogue) without breaking anything in the game. Even though you’re giving them DEX saves, you’re taking away CON saves and replacing them with something less beneficial (CHA, STR, or INT).

Whichever pair you choose from the options described above, the Fighter still only has one common save and one uncommon save. Moreover, although DEX, CON, and WIS saves don’t have the same frequency in the game, the game is balanced in such a way that each of those saves is more or less as useful as each other. (In other words, after swapping saves in the way I’ve described, you shouldn’t have to worry that the Fighter is significantly more or less powerful than any other Fighter, just different. If you sat down and crunched the numbers, you might find that the Fighter has become slightly more or less powerful, but not in a way that would be problematic at the table.)

Note that the pair of CON and INT and the pair of STR and WIS shouldn’t be problematic, either, but no class in the core game uses either of those pairs (although some Unearthed Arcana supplements have done so). It really shouldn’t matter what pair you pick as long as it includes one common and one uncommon save. The reason I listed all the existing pairs in the game above is that it’s easier to get a feel for the theme behind each pair when there’s already a class that goes with it, whereas coming up with a pair on your own requires you to ascertain that feel for yourself.

python – Error: decoding to str: need a bytes-like object, NoneType found -(Django)

I am using Django. When I go to the url that uses the create function in views.py, I get the error: decoding to str: need a bytes-like object, NoneType found
Does anyone know how to fix this?

class SearchForm(forms.Form):
search = forms.CharField()


class EntryForm(forms.Form):
name = forms.CharField()
page = forms.CharField(widget=forms.Textarea)

def create(request):
form = SearchForm(request.POST)
create_form = EntryForm(request.POST)
if request.method == "POST":
    if create_form.is_valid():

        name = create_form.cleaned_data("name")
        page = create_form.cleaned_data("page")
        if name in util.list_entries():
            return render(request, "encyclopedia/error.html", {
                "form": form
            })

        else:
            util.save_entry(name, page)
            entry_text = markdown2.markdown(util.get_entry(name))
            return render(request, "encyclopedia/entries.html", {
                "form": form,
                "entry": name,
                "text": entry_text
            })
    elif form.is_valid():
        search = form.cleaned_data("search")
        if search in util.list_entries():
            text = markdown2.markdown(util.get_entry(search))
            return render(request, "encyclopedia/entries.html", {
                "form": form,
                "entry": search,
                "text": text
            })
        else:
            results = ()
            for entry in util.list_entries():
                if search in entry:
                    results.append(entry)
            return render(request, "encyclopedia/search.html", {
                "form": form,
                "results": results
            })

    else:
        return render(request, "encyclopedia/create.html", {
            "form": form,
            "name": create_form.name,
            "create": create_form.page
        })

else:
    return render(request, "encyclopedia/create.html", {
        "form": form,
        "name": create_form.name,
        "create": create_form.page
    })